Class AgentBuilder.CircularityLock.WithInnerClassLoadingLock
java.lang.Object
net.bytebuddy.agent.builder.AgentBuilder.CircularityLock.WithInnerClassLoadingLock
- All Implemented Interfaces:
AgentBuilder.CircularityLock
- Direct Known Subclasses:
AgentBuilder.CircularityLock.Default, AgentBuilder.CircularityLock.Global
- Enclosing interface:
AgentBuilder.CircularityLock
public abstract static class AgentBuilder.CircularityLock.WithInnerClassLoadingLock
extends Object
implements AgentBuilder.CircularityLock
A circularity lock that surrounds the locking mechanism with a global lock to prevent that the
locking mechanism itself loads classes and causes a circularity issue.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA trivial lock that monitors if a class is currently loaded by the current thread.Nested classes/interfaces inherited from interface AgentBuilder.CircularityLock
AgentBuilder.CircularityLock.Default, AgentBuilder.CircularityLock.Global, AgentBuilder.CircularityLock.Inactive, AgentBuilder.CircularityLock.WithInnerClassLoadingLock -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intThe default size of the global class loading lock array. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWithInnerClassLoadingLock(int size) Creates a circularity lock with a global outer lock. -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AgentBuilder.CircularityLock
release
-
Field Details
-
DEFAULT_SIZE
protected static final int DEFAULT_SIZEThe default size of the global class loading lock array.- See Also:
-
-
Constructor Details
-
WithInnerClassLoadingLock
protected WithInnerClassLoadingLock(int size) Creates a circularity lock with a global outer lock.- Parameters:
size- The amount of locks used in parallel or0if no global locks should be used.
-
-
Method Details
-
acquire
public boolean acquire()Attempts to acquire a circularity lock.- Specified by:
acquirein interfaceAgentBuilder.CircularityLock- Returns:
trueif the lock was acquired successfully,falseif it is already hold.
-
doAcquire
protected abstract boolean doAcquire()Acquires the actual lock for the current thread.- Returns:
trueif the lock was acquired successfully,falseif it is already hold.
-