Package net.bytebuddy.agent.builder
Class AgentBuilder.RedefinitionStrategy.ResubmissionStrategy.Enabled.Resubmitter
java.lang.Object
net.bytebuddy.agent.builder.AgentBuilder.Listener.Adapter
net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.ResubmissionStrategy.Enabled.Resubmitter
- All Implemented Interfaces:
AgentBuilder.Listener
,AgentBuilder.RedefinitionStrategy.ResubmissionEnforcer
- Enclosing class:
AgentBuilder.RedefinitionStrategy.ResubmissionStrategy.Enabled
protected static class AgentBuilder.RedefinitionStrategy.ResubmissionStrategy.Enabled.Resubmitter
extends AgentBuilder.Listener.Adapter
implements AgentBuilder.RedefinitionStrategy.ResubmissionEnforcer
A handler for resubmissions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A set projection for aConcurrentHashMap
.Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.Listener
AgentBuilder.Listener.Adapter, AgentBuilder.Listener.Compound, AgentBuilder.Listener.Filtering, AgentBuilder.Listener.ModuleReadEdgeCompleting, AgentBuilder.Listener.NoOp, AgentBuilder.Listener.StreamWriting, AgentBuilder.Listener.WithErrorsOnly, AgentBuilder.Listener.WithTransformationsOnly
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.ResubmissionEnforcer
AgentBuilder.RedefinitionStrategy.ResubmissionEnforcer.Disabled
-
Field Summary
FieldsModifier and TypeFieldDescriptionA matcher to determine resubmissions without errors.A matcher to determine resubmissions on errors.private final ConcurrentMap
<AgentBuilder.RedefinitionStrategy.ResubmissionStrategy.Enabled.StorageKey, Set<String>> A map of class loaders to their types to resubmit.Fields inherited from interface net.bytebuddy.agent.builder.AgentBuilder.Listener
LOADED
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Resubmitter
(AgentBuilder.RedefinitionListenable.ResubmissionOnErrorMatcher resubmissionOnErrorMatcher, AgentBuilder.RedefinitionListenable.ResubmissionImmediateMatcher resubmissionImmediateMatcher, ConcurrentMap<AgentBuilder.RedefinitionStrategy.ResubmissionStrategy.Enabled.StorageKey, Set<String>> types) Creates a new resubmitter. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isEnforced
(String typeName, ClassLoader classLoader, JavaModule module, Class<?> classBeingRedefined) Returnstrue
if a class should be scheduled for resubmission.void
onError
(String typeName, ClassLoader classLoader, JavaModule module, boolean loaded, Throwable throwable) Invoked when an error has occurred during transformation.Methods inherited from class net.bytebuddy.agent.builder.AgentBuilder.Listener.Adapter
onComplete, onDiscovery, onIgnored, onTransformation
-
Field Details
-
resubmissionOnErrorMatcher
private final AgentBuilder.RedefinitionListenable.ResubmissionOnErrorMatcher resubmissionOnErrorMatcherA matcher to determine resubmissions on errors. -
resubmissionImmediateMatcher
private final AgentBuilder.RedefinitionListenable.ResubmissionImmediateMatcher resubmissionImmediateMatcherA matcher to determine resubmissions without errors. -
types
private final ConcurrentMap<AgentBuilder.RedefinitionStrategy.ResubmissionStrategy.Enabled.StorageKey,Set<String>> typesA map of class loaders to their types to resubmit.
-
-
Constructor Details
-
Resubmitter
protected Resubmitter(AgentBuilder.RedefinitionListenable.ResubmissionOnErrorMatcher resubmissionOnErrorMatcher, AgentBuilder.RedefinitionListenable.ResubmissionImmediateMatcher resubmissionImmediateMatcher, ConcurrentMap<AgentBuilder.RedefinitionStrategy.ResubmissionStrategy.Enabled.StorageKey, Set<String>> types) Creates a new resubmitter.- Parameters:
resubmissionOnErrorMatcher
- A matcher to determine resubmissions on errors.resubmissionImmediateMatcher
- A matcher to determine resubmissions without errors.types
- A map of class loaders to their types to resubmit.
-
-
Method Details
-
onError
public void onError(String typeName, @MaybeNull ClassLoader classLoader, @MaybeNull JavaModule module, boolean loaded, Throwable throwable) Invoked when an error has occurred during transformation.- Specified by:
onError
in interfaceAgentBuilder.Listener
- Overrides:
onError
in classAgentBuilder.Listener.Adapter
- Parameters:
typeName
- The binary name of the instrumented type.classLoader
- The class loader which is loading this type ornull
if loaded by the boots loader.module
- The instrumented type's module ornull
if the current VM does not support modules.loaded
-true
if the type is already loaded.throwable
- The occurred error.
-
isEnforced
public boolean isEnforced(String typeName, @MaybeNull ClassLoader classLoader, @MaybeNull JavaModule module, @MaybeNull Class<?> classBeingRedefined) Returnstrue
if a class should be scheduled for resubmission.- Specified by:
isEnforced
in interfaceAgentBuilder.RedefinitionStrategy.ResubmissionEnforcer
- Parameters:
typeName
- The name of the instrumented class.classLoader
- The class loader of the instrumented class ornull
if the boot loader.module
- The module of the instrumented class ornull
if the module system is not supported.classBeingRedefined
- The class to be redefined ornull
if the current type is loaded for the first time.- Returns:
true
if the class should be scheduled for resubmission.
-