Package net.bytebuddy.agent.builder
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 class
A trivial lock that monitors if a class is currently loaded by the current thread.Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.CircularityLock
AgentBuilder.CircularityLock.Default, AgentBuilder.CircularityLock.Global, AgentBuilder.CircularityLock.Inactive, AgentBuilder.CircularityLock.WithInnerClassLoadingLock
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
The default size of the global class loading lock array.An additional global lock that avoids circularity errors cause by class loading by the locking mechanism. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
WithInnerClassLoadingLock
(int size) Creates a circularity lock with a global outer lock. -
Method Summary
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.CircularityLock
release
-
Field Details
-
DEFAULT_SIZE
protected static final int DEFAULT_SIZEThe default size of the global class loading lock array.- See Also:
-
lock
An additional global lock that avoids circularity errors cause by class loading by the locking mechanism.
-
-
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 or0
if no global locks should be used.
-
-
Method Details
-
acquire
public boolean acquire()Attempts to acquire a circularity lock.- Specified by:
acquire
in interfaceAgentBuilder.CircularityLock
- Returns:
true
if the lock was acquired successfully,false
if it is already hold.
-
doAcquire
protected abstract boolean doAcquire()Acquires the actual lock for the current thread.- Returns:
true
if the lock was acquired successfully,false
if it is already hold.
-