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 classes/interfaces inherited from class net.bytebuddy.agent.builder.AgentBuilder.Default
AgentBuilder.Default.Delegator<T extends AgentBuilder.Matchable<T>>, AgentBuilder.Default.Dispatcher, AgentBuilder.Default.ExecutingTransformer, AgentBuilder.Default.Ignoring, AgentBuilder.Default.NativeMethodStrategy, AgentBuilder.Default.Redefining, AgentBuilder.Default.Transformation, AgentBuilder.Default.Transforming
-
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.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.WithImplicitDiscoveryStrategy, AgentBuilder.RedefinitionListenable.WithoutBatchStrategy
-
-
Field Summary
-
Fields inherited from class net.bytebuddy.agent.builder.AgentBuilder.Default
byteBuddy, circularityLock, classFileBufferStrategy, descriptionStrategy, fallbackStrategy, ignoreMatcher, initializationStrategy, injectionStrategy, installationListener, lambdaInstrumentationStrategy, listener, locationStrategy, nativeMethodStrategy, poolStrategy, redefinitionBatchAllocator, redefinitionDiscoveryStrategy, redefinitionListener, redefinitionResubmissionStrategy, redefinitionStrategy, transformations, transformerDecorator, typeStrategy
-
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AgentBuilder.RedefinitionListenable
redefineOnly(java.lang.Class<?>... type)
Limits the redefinition attempt to the specified types.AgentBuilder.RedefinitionListenable.WithImplicitDiscoveryStrategy
with(AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator)
A batch allocator is responsible for diving a redefining of existing types into several chunks.AgentBuilder.RedefinitionListenable
with(AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy)
A discovery strategy is responsible for locating loaded types that should be considered for redefinition.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.AgentBuilder
withResubmission(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler)
Enables resubmission of failed transformations by applying a retransformation of the loaded type.AgentBuilder
withResubmission(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler, ElementMatcher<? super java.lang.Throwable> matcher)
Enables resubmission of failed transformations by applying a retransformation of the loaded type.AgentBuilder
withResubmission(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler, ElementMatcher<? super java.lang.Throwable> matcher, ElementMatcher<? super java.lang.ClassLoader> classLoaderFilter)
Enables resubmission of failed transformations by applying a retransformation of the loaded type.-
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, patchOnByteBuddyAgent, type, type, type, type, 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, patchOnByteBuddyAgent, type, type, type, type, with, with, with, with, with, with, with, with, with, with, with, with, with, with, with
-
-
-
-
Constructor Detail
-
Redefining
protected Redefining(ByteBuddy byteBuddy, AgentBuilder.Listener listener, AgentBuilder.CircularityLock circularityLock, AgentBuilder.PoolStrategy poolStrategy, AgentBuilder.TypeStrategy typeStrategy, AgentBuilder.LocationStrategy locationStrategy, AgentBuilder.Default.NativeMethodStrategy nativeMethodStrategy, 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, java.util.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 type locator to use.typeStrategy
- The definition handler to use.locationStrategy
- The location strategy to use.nativeMethodStrategy
- The native method strategy to apply.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 Detail
-
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
public AgentBuilder.RedefinitionListenable redefineOnly(java.lang.Class<?>... type)
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 withResubmission(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler)
Enables resubmission of failed transformations by applying a retransformation of the loaded type. This can be meaningful if class files cannot be located from the class loader as a resource where the loaded type becomes available.- Specified by:
withResubmission
in interfaceAgentBuilder.RedefinitionListenable
- Parameters:
resubmissionScheduler
- A scheduler which is responsible for scheduling the resubmission job.- Returns:
- A new instance of this agent builder that applies resubmission.
-
withResubmission
public AgentBuilder withResubmission(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler, ElementMatcher<? super java.lang.Throwable> matcher)
Enables resubmission of failed transformations by applying a retransformation of the loaded type. This can be meaningful if class files cannot be located from the class loader as a resource where the loaded type becomes available.- Specified by:
withResubmission
in interfaceAgentBuilder.RedefinitionListenable
- Parameters:
resubmissionScheduler
- A scheduler which is responsible for scheduling the resubmission job.matcher
- A matcher that filters throwable instances where non-matched throwables are not triggering a resubmission.- Returns:
- A new instance of this agent builder that applies resubmission.
-
withResubmission
public AgentBuilder withResubmission(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler, ElementMatcher<? super java.lang.Throwable> matcher, ElementMatcher<? super java.lang.ClassLoader> classLoaderFilter)
Enables resubmission of failed transformations by applying a retransformation of the loaded type. This can be meaningful if class files cannot be located from the class loader as a resource where the loaded type becomes available.- Specified by:
withResubmission
in interfaceAgentBuilder.RedefinitionListenable
- Parameters:
resubmissionScheduler
- A scheduler which is responsible for scheduling the resubmission job.matcher
- A matcher that filters throwable instances where non-matched throwables are not triggering a resubmission.classLoaderFilter
- A filter to exclude class loader instances from resubmission before applying it.- Returns:
- A new instance of this agent builder that applies resubmission.
-
-