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 java.lang.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 Classes Modifier and Type Class Description protected static class
AgentBuilder.CircularityLock.WithInnerClassLoadingLock.TrivialLock
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
Fields Modifier and Type Field Description protected static int
DEFAULT_SIZE
The default size of the global class loading lock array.private AgentBuilder.CircularityLock.WithInnerClassLoadingLock.TrivialLock[]
lock
An additional global lock that avoids circularity errors cause by class loading by the locking mechanism.
-
Constructor Summary
Constructors Modifier Constructor Description protected
WithInnerClassLoadingLock(int size)
Creates a circularity lock with a global outer lock.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
acquire()
Attempts to acquire a circularity lock.protected abstract boolean
doAcquire()
Acquires the actual lock for the current thread.-
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 Detail
-
DEFAULT_SIZE
protected static final int DEFAULT_SIZE
The default size of the global class loading lock array.- See Also:
- Constant Field Values
-
lock
private final AgentBuilder.CircularityLock.WithInnerClassLoadingLock.TrivialLock[] lock
An additional global lock that avoids circularity errors cause by class loading by the locking mechanism.
-
-
Method Detail
-
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.
-
-