Package net.bytebuddy.agent.builder
Class AgentBuilder.Default.Redefining
java.lang.Object
net.bytebuddy.agent.builder.AgentBuilder.Default
net.bytebuddy.agent.builder.AgentBuilder.Default.Redefining
- All Implemented Interfaces:
AgentBuilder
,AgentBuilder.RedefinitionListenable
,AgentBuilder.RedefinitionListenable.WithImplicitDiscoveryStrategy
,AgentBuilder.RedefinitionListenable.WithoutBatchStrategy
- Enclosing class:
AgentBuilder.Default
protected static class AgentBuilder.Default.Redefining
extends AgentBuilder.Default
implements AgentBuilder.RedefinitionListenable.WithoutBatchStrategy
An implementation of a default agent builder that allows for refinement of the redefinition strategy.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
A delegator that applies a resubmission.Nested classes/interfaces inherited from class net.bytebuddy.agent.builder.AgentBuilder.Default
AgentBuilder.Default.Delegator, AgentBuilder.Default.Dispatcher, AgentBuilder.Default.ExecutingTransformer, AgentBuilder.Default.Ignoring, AgentBuilder.Default.NativeMethodStrategy, AgentBuilder.Default.Redefining, AgentBuilder.Default.Transformation, AgentBuilder.Default.Transforming, AgentBuilder.Default.WarmupStrategy
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder
AgentBuilder.CircularityLock, AgentBuilder.ClassFileBufferStrategy, AgentBuilder.Default, AgentBuilder.DescriptionStrategy, AgentBuilder.FallbackStrategy, AgentBuilder.Identified, AgentBuilder.Ignored, AgentBuilder.InitializationStrategy, AgentBuilder.InjectionStrategy, AgentBuilder.InstallationListener, AgentBuilder.LambdaInstrumentationStrategy, AgentBuilder.Listener, AgentBuilder.LocationStrategy, AgentBuilder.Matchable<T extends AgentBuilder.Matchable<T>>, AgentBuilder.PatchMode, AgentBuilder.PoolStrategy, AgentBuilder.RawMatcher, AgentBuilder.RedefinitionListenable, AgentBuilder.RedefinitionStrategy, AgentBuilder.Transformer, AgentBuilder.TransformerDecorator, AgentBuilder.TypeStrategy
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.RedefinitionListenable
AgentBuilder.RedefinitionListenable.ResubmissionImmediateMatcher, AgentBuilder.RedefinitionListenable.ResubmissionOnErrorMatcher, AgentBuilder.RedefinitionListenable.WithImplicitDiscoveryStrategy, AgentBuilder.RedefinitionListenable.WithoutBatchStrategy, AgentBuilder.RedefinitionListenable.WithoutResubmissionSpecification, AgentBuilder.RedefinitionListenable.WithResubmissionSpecification
-
Field Summary
Fields inherited from class net.bytebuddy.agent.builder.AgentBuilder.Default
byteBuddy, circularityLock, classFileBufferStrategy, classFileLocator, descriptionStrategy, fallbackStrategy, ignoreMatcher, initializationStrategy, injectionStrategy, installationListener, lambdaInstrumentationStrategy, listener, locationStrategy, nativeMethodStrategy, poolStrategy, redefinitionBatchAllocator, redefinitionDiscoveryStrategy, redefinitionListener, redefinitionResubmissionStrategy, redefinitionStrategy, transformations, transformerDecorator, typeStrategy, warmupStrategy
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Redefining
(ByteBuddy byteBuddy, AgentBuilder.Listener listener, AgentBuilder.CircularityLock circularityLock, AgentBuilder.PoolStrategy poolStrategy, AgentBuilder.TypeStrategy typeStrategy, AgentBuilder.LocationStrategy locationStrategy, ClassFileLocator classFileLocator, AgentBuilder.Default.NativeMethodStrategy nativeMethodStrategy, AgentBuilder.Default.WarmupStrategy warmupStrategy, AgentBuilder.TransformerDecorator transformerDecorator, AgentBuilder.InitializationStrategy initializationStrategy, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener, AgentBuilder.RedefinitionStrategy.ResubmissionStrategy redefinitionResubmissionStrategy, AgentBuilder.InjectionStrategy injectionStrategy, AgentBuilder.LambdaInstrumentationStrategy lambdaInstrumentationStrategy, AgentBuilder.DescriptionStrategy descriptionStrategy, AgentBuilder.FallbackStrategy fallbackStrategy, AgentBuilder.ClassFileBufferStrategy classFileBufferStrategy, AgentBuilder.InstallationListener installationListener, AgentBuilder.RawMatcher ignoreMatcher, List<AgentBuilder.Default.Transformation> transformations) Creates a new default agent builder that allows for refinement of the redefinition strategy. -
Method Summary
Modifier and TypeMethodDescriptionredefineOnly
(Class<?>... type) Limits the redefinition attempt to the specified types.with
(AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator) A batch allocator is responsible for diving a redefining of existing types into several chunks.with
(AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy) A discovery strategy is responsible for locating loaded types that should be considered for redefinition.with
(AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) A redefinition listener is invoked before each batch of type redefinitions and on every error as well as after the redefinition was completed.withResubmission
(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler) Specifies resubmission for given unloaded types or types that fail upon an exception during instrumentation.Methods inherited from class net.bytebuddy.agent.builder.AgentBuilder.Default
assureReadEdgeFromAndTo, assureReadEdgeFromAndTo, assureReadEdgeFromAndTo, assureReadEdgeTo, assureReadEdgeTo, assureReadEdgeTo, disableClassFormatChanges, disableNativeMethodPrefix, enableNativeMethodPrefix, ignore, ignore, ignore, ignore, installOn, installOnByteBuddyAgent, makeRaw, of, of, of, of, of, of, of, of, patchOn, patchOn, patchOnByteBuddyAgent, patchOnByteBuddyAgent, type, type, type, type, warmUp, warmUp, with, with, with, with, with, with, with, with, with, with, with, with, with, with, with, with
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.bytebuddy.agent.builder.AgentBuilder
assureReadEdgeFromAndTo, assureReadEdgeFromAndTo, assureReadEdgeFromAndTo, assureReadEdgeTo, assureReadEdgeTo, assureReadEdgeTo, disableClassFormatChanges, disableNativeMethodPrefix, enableNativeMethodPrefix, ignore, ignore, ignore, ignore, installOn, installOnByteBuddyAgent, makeRaw, patchOn, patchOn, patchOnByteBuddyAgent, patchOnByteBuddyAgent, type, type, type, type, warmUp, warmUp, with, with, with, with, with, with, with, with, with, with, with, with, with, with, with, with
-
Constructor Details
-
Redefining
protected Redefining(ByteBuddy byteBuddy, AgentBuilder.Listener listener, AgentBuilder.CircularityLock circularityLock, AgentBuilder.PoolStrategy poolStrategy, AgentBuilder.TypeStrategy typeStrategy, AgentBuilder.LocationStrategy locationStrategy, ClassFileLocator classFileLocator, AgentBuilder.Default.NativeMethodStrategy nativeMethodStrategy, AgentBuilder.Default.WarmupStrategy warmupStrategy, AgentBuilder.TransformerDecorator transformerDecorator, AgentBuilder.InitializationStrategy initializationStrategy, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener, AgentBuilder.RedefinitionStrategy.ResubmissionStrategy redefinitionResubmissionStrategy, AgentBuilder.InjectionStrategy injectionStrategy, AgentBuilder.LambdaInstrumentationStrategy lambdaInstrumentationStrategy, AgentBuilder.DescriptionStrategy descriptionStrategy, AgentBuilder.FallbackStrategy fallbackStrategy, AgentBuilder.ClassFileBufferStrategy classFileBufferStrategy, AgentBuilder.InstallationListener installationListener, AgentBuilder.RawMatcher ignoreMatcher, List<AgentBuilder.Default.Transformation> transformations) Creates a new default agent builder that allows for refinement of the redefinition strategy.- Parameters:
byteBuddy
- The Byte Buddy instance to be used.listener
- The listener to notify on transformations.circularityLock
- The circularity lock to use.poolStrategy
- The pool strategy to use.typeStrategy
- The definition handler to use.locationStrategy
- The location strategy to use.classFileLocator
- A class file locator to be used for additional lookup of globally available types.nativeMethodStrategy
- The native method strategy to apply.warmupStrategy
- The warmup strategy to use.transformerDecorator
- A decorator to wrap the created class file transformer.initializationStrategy
- The initialization strategy to use for transformed types.redefinitionStrategy
- The redefinition strategy to apply.redefinitionDiscoveryStrategy
- The discovery strategy for loaded types to be redefined.redefinitionBatchAllocator
- The batch allocator for the redefinition strategy to apply.redefinitionListener
- The redefinition listener for the redefinition strategy to apply.redefinitionResubmissionStrategy
- The resubmission strategy to apply.injectionStrategy
- The injection strategy to use.lambdaInstrumentationStrategy
- A strategy to determine of theLambdaMetafactory
should be instrumented to allow for the instrumentation of classes that represent lambda expressions.descriptionStrategy
- The description strategy for resolving type descriptions for types.fallbackStrategy
- The fallback strategy to apply.classFileBufferStrategy
- The class file buffer strategy to use.installationListener
- The installation listener to notify.ignoreMatcher
- Identifies types that should not be instrumented.transformations
- The transformations to apply on non-ignored types.
-
-
Method Details
-
with
public AgentBuilder.RedefinitionListenable.WithImplicitDiscoveryStrategy with(AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator) A batch allocator is responsible for diving a redefining of existing types into several chunks. This allows to narrow down errors for the redefining of specific types or to apply aAgentBuilder.RedefinitionStrategy.Listener
action between chunks.- Specified by:
with
in interfaceAgentBuilder.RedefinitionListenable.WithoutBatchStrategy
- Parameters:
redefinitionBatchAllocator
- The batch allocator to use.- Returns:
- A new instance of this agent builder which makes use of the specified batch allocator.
-
redefineOnly
Limits the redefinition attempt to the specified types.- Specified by:
redefineOnly
in interfaceAgentBuilder.RedefinitionListenable.WithImplicitDiscoveryStrategy
- Parameters:
type
- The types to consider for redefinition.- Returns:
- A new instance of this agent builder which only considers the supplied types for redefinition.
-
with
public AgentBuilder.RedefinitionListenable with(AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy) A discovery strategy is responsible for locating loaded types that should be considered for redefinition.- Specified by:
with
in interfaceAgentBuilder.RedefinitionListenable.WithImplicitDiscoveryStrategy
- Parameters:
redefinitionDiscoveryStrategy
- The redefinition discovery strategy to use.- Returns:
- A new instance of this agent builder which makes use of the specified discovery strategy.
-
with
public AgentBuilder.RedefinitionListenable with(AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) A redefinition listener is invoked before each batch of type redefinitions and on every error as well as after the redefinition was completed. A redefinition listener can be used for debugging or logging purposes and to apply actions between each batch, e.g. to pause or wait in order to avoid rendering the current VM non-responsive if a lot of classes are redefined.
Adding several listeners does not replace previous listeners but applies them in the registration order.
- Specified by:
with
in interfaceAgentBuilder.RedefinitionListenable
- Parameters:
redefinitionListener
- The listener to register.- Returns:
- A new instance of this agent builder which notifies the specified listener upon type redefinitions.
-
withResubmission
public AgentBuilder.RedefinitionListenable.WithoutResubmissionSpecification withResubmission(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler) Specifies resubmission for given unloaded types or types that fail upon an exception during instrumentation.- Specified by:
withResubmission
in interfaceAgentBuilder.RedefinitionListenable
- Parameters:
resubmissionScheduler
- The resubmission scheduler to use.- Returns:
- A new builder to determine what types should be resubmitted given the supplied resubmission scheduler.
-