Package net.bytebuddy.build
Class Plugin.Engine.Dispatcher.ForParallelTransformation
- java.lang.Object
-
- net.bytebuddy.build.Plugin.Engine.Dispatcher.ForParallelTransformation
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Plugin.Engine.Dispatcher
- Direct Known Subclasses:
Plugin.Engine.Dispatcher.ForParallelTransformation.WithThrowawayExecutorService
- Enclosing interface:
- Plugin.Engine.Dispatcher
public static class Plugin.Engine.Dispatcher.ForParallelTransformation extends java.lang.Object implements Plugin.Engine.Dispatcher
A dispatcher that applies transformations within one or more threads in parallel to the default transformer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Plugin.Engine.Dispatcher.ForParallelTransformation.EagerWork
An eager materialization that does not defer processing after preprocessing.static class
Plugin.Engine.Dispatcher.ForParallelTransformation.Factory
A factory for a dispatcher that uses a given executor service for parallel dispatching.static class
Plugin.Engine.Dispatcher.ForParallelTransformation.WithThrowawayExecutorService
A parallel dispatcher that shuts down its executor service upon completion of a plugin engine's application.-
Nested classes/interfaces inherited from interface net.bytebuddy.build.Plugin.Engine.Dispatcher
Plugin.Engine.Dispatcher.ForParallelTransformation, Plugin.Engine.Dispatcher.ForSerialTransformation, Plugin.Engine.Dispatcher.Materializable
-
-
Field Summary
Fields Modifier and Type Field Description private int
deferred
A count of deferred processings.private java.util.Map<TypeDescription,java.util.List<java.lang.Throwable>>
failed
A mapping of all types that failed during transformation to the exceptions that explain the failure.private java.util.Set<java.util.concurrent.Future<?>>
futures
A collection of futures that are currently scheduled.private java.util.concurrent.CompletionService<Plugin.Engine.Dispatcher.Materializable>
materializers
A completion service for all materializers.private java.util.concurrent.CompletionService<java.util.concurrent.Callable<Plugin.Engine.Dispatcher.Materializable>>
preprocessings
A completion service for all preprocessings.private Plugin.Engine.Target.Sink
sink
The target sink.private java.util.List<TypeDescription>
transformed
A list of all types that are transformed.private java.util.List<java.lang.String>
unresolved
A list of type names that could not be resolved.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForParallelTransformation(java.util.concurrent.Executor executor, Plugin.Engine.Target.Sink sink, java.util.List<TypeDescription> transformed, java.util.Map<TypeDescription,java.util.List<java.lang.Throwable>> failed, java.util.List<java.lang.String> unresolved)
Creates a new dispatcher that applies transformations in parallel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(java.util.concurrent.Callable<? extends java.util.concurrent.Callable<? extends Plugin.Engine.Dispatcher.Materializable>> work, boolean eager)
Accepts a new work assignment.void
close()
void
complete()
Completes the work being handled.
-
-
-
Field Detail
-
sink
private final Plugin.Engine.Target.Sink sink
The target sink.
-
transformed
private final java.util.List<TypeDescription> transformed
A list of all types that are transformed.
-
failed
private final java.util.Map<TypeDescription,java.util.List<java.lang.Throwable>> failed
A mapping of all types that failed during transformation to the exceptions that explain the failure.
-
unresolved
private final java.util.List<java.lang.String> unresolved
A list of type names that could not be resolved.
-
preprocessings
private final java.util.concurrent.CompletionService<java.util.concurrent.Callable<Plugin.Engine.Dispatcher.Materializable>> preprocessings
A completion service for all preprocessings.
-
materializers
private final java.util.concurrent.CompletionService<Plugin.Engine.Dispatcher.Materializable> materializers
A completion service for all materializers.
-
deferred
private int deferred
A count of deferred processings.
-
futures
private final java.util.Set<java.util.concurrent.Future<?>> futures
A collection of futures that are currently scheduled.
-
-
Constructor Detail
-
ForParallelTransformation
protected ForParallelTransformation(java.util.concurrent.Executor executor, Plugin.Engine.Target.Sink sink, java.util.List<TypeDescription> transformed, java.util.Map<TypeDescription,java.util.List<java.lang.Throwable>> failed, java.util.List<java.lang.String> unresolved)
Creates a new dispatcher that applies transformations in parallel.- Parameters:
executor
- The executor to delegate any work to.sink
- The target sink.transformed
- A list of all types that are transformed.failed
- A mapping of all types that failed during transformation to the exceptions that explain the failure.unresolved
- A list of type names that could not be resolved.
-
-
Method Detail
-
accept
public void accept(java.util.concurrent.Callable<? extends java.util.concurrent.Callable<? extends Plugin.Engine.Dispatcher.Materializable>> work, boolean eager)
Accepts a new work assignment.- Specified by:
accept
in interfacePlugin.Engine.Dispatcher
- Parameters:
work
- The work to handle prefixed by a preprocessing step.eager
-true
if the processing does not need to be deferred until all preprocessing is complete.
-
complete
public void complete() throws java.io.IOException
Completes the work being handled.- Specified by:
complete
in interfacePlugin.Engine.Dispatcher
- Throws:
java.io.IOException
- If an I/O exception occurs.
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-