Package net.bytebuddy.agent.builder
Class AgentBuilder.RedefinitionStrategy.Listener.BatchReallocator
- java.lang.Object
-
- net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener.Adapter
-
- net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener.BatchReallocator
-
- All Implemented Interfaces:
AgentBuilder.RedefinitionStrategy.Listener
- Enclosing interface:
- AgentBuilder.RedefinitionStrategy.Listener
@Enhance public static class AgentBuilder.RedefinitionStrategy.Listener.BatchReallocator extends AgentBuilder.RedefinitionStrategy.Listener.Adapter
A batch reallocator allows to split up a failed retransformation into additional batches which are reenqueed to the current retransformation process. To do so, any batch with at least to classes is rerouted through a
AgentBuilder.RedefinitionStrategy.BatchAllocator
which is responsible for regrouping the classes that failed to be retransformed into new batches.Important: To avoid endless looping over classes that cannot be successfully retransformed, the supplied batch allocator must not resubmit batches that previously failed as an identical outcome is likely.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener
AgentBuilder.RedefinitionStrategy.Listener.Adapter, AgentBuilder.RedefinitionStrategy.Listener.BatchReallocator, AgentBuilder.RedefinitionStrategy.Listener.Compound, AgentBuilder.RedefinitionStrategy.Listener.ErrorEscalating, AgentBuilder.RedefinitionStrategy.Listener.NoOp, AgentBuilder.RedefinitionStrategy.Listener.Pausing, AgentBuilder.RedefinitionStrategy.Listener.StreamWriting, AgentBuilder.RedefinitionStrategy.Listener.Yielding
-
-
Field Summary
Fields Modifier and Type Field Description private AgentBuilder.RedefinitionStrategy.BatchAllocator
batchAllocator
The batch allocator to use for reallocating failed batches.
-
Constructor Summary
Constructors Constructor Description BatchReallocator(AgentBuilder.RedefinitionStrategy.BatchAllocator batchAllocator)
Creates a new batch reallocator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<? extends java.util.List<java.lang.Class<?>>>
onError(int index, java.util.List<java.lang.Class<?>> batch, java.lang.Throwable throwable, java.util.List<java.lang.Class<?>> types)
Invoked upon an error during a batch.static AgentBuilder.RedefinitionStrategy.Listener
splitting()
Creates a batch allocator that splits any batch into two parts and resubmits these parts as two batches.-
Methods inherited from class net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener.Adapter
onBatch, onComplete
-
-
-
-
Field Detail
-
batchAllocator
private final AgentBuilder.RedefinitionStrategy.BatchAllocator batchAllocator
The batch allocator to use for reallocating failed batches.
-
-
Constructor Detail
-
BatchReallocator
public BatchReallocator(AgentBuilder.RedefinitionStrategy.BatchAllocator batchAllocator)
Creates a new batch reallocator.- Parameters:
batchAllocator
- The batch allocator to use for reallocating failed batches.
-
-
Method Detail
-
splitting
public static AgentBuilder.RedefinitionStrategy.Listener splitting()
Creates a batch allocator that splits any batch into two parts and resubmits these parts as two batches.- Returns:
- A batch reallocating batch listener that splits failed batches into two parts for resubmission.
-
onError
public java.lang.Iterable<? extends java.util.List<java.lang.Class<?>>> onError(int index, java.util.List<java.lang.Class<?>> batch, java.lang.Throwable throwable, java.util.List<java.lang.Class<?>> types)
Description copied from class:AgentBuilder.RedefinitionStrategy.Listener.Adapter
Invoked upon an error during a batch. This method is not invoked if the failure handler handled this error.- Specified by:
onError
in interfaceAgentBuilder.RedefinitionStrategy.Listener
- Overrides:
onError
in classAgentBuilder.RedefinitionStrategy.Listener.Adapter
- Parameters:
index
- A running index of the batch starting at0
.batch
- The types included in this batch.throwable
- The throwable that caused this invocation.types
- All types included in the redefinition.- Returns:
- A set of classes which should be attempted to be redefined. Typically, this should be a subset of the classes
contained in
batch
but not all classes.
-
-