Package net.bytebuddy.agent.builder
Class AgentBuilder.CircularityLock.Global
java.lang.Object
net.bytebuddy.agent.builder.AgentBuilder.CircularityLock.WithInnerClassLoadingLock
net.bytebuddy.agent.builder.AgentBuilder.CircularityLock.Global
- All Implemented Interfaces:
AgentBuilder.CircularityLock
- Enclosing interface:
AgentBuilder.CircularityLock
@Enhance
public static class AgentBuilder.CircularityLock.Global
extends AgentBuilder.CircularityLock.WithInnerClassLoadingLock
A circularity lock that holds a global monitor and does not permit concurrent access.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.bytebuddy.agent.builder.AgentBuilder.CircularityLock.WithInnerClassLoadingLock
AgentBuilder.CircularityLock.WithInnerClassLoadingLock.TrivialLock
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 TypeFieldDescriptionprivate final Lock
The lock to hold.private final long
The time to wait for the lock.private final TimeUnit
The time's time unit.Fields inherited from class net.bytebuddy.agent.builder.AgentBuilder.CircularityLock.WithInnerClassLoadingLock
DEFAULT_SIZE
-
Constructor Summary
ConstructorsConstructorDescriptionGlobal()
Creates a new global circularity lock that does not wait for a release and a default size for the amount of global locks.Global
(int size) Creates a new global circularity lock that does not wait for a release.Creates a new global circularity lock.Creates a new global circularity lock with a default size for the amount of global locks. -
Method Summary
Methods inherited from class net.bytebuddy.agent.builder.AgentBuilder.CircularityLock.WithInnerClassLoadingLock
acquire
-
Field Details
-
lock
The lock to hold. -
time
private final long timeThe time to wait for the lock. -
timeUnit
The time's time unit.
-
-
Constructor Details
-
Global
public Global()Creates a new global circularity lock that does not wait for a release and a default size for the amount of global locks. -
Global
Creates a new global circularity lock with a default size for the amount of global locks.- Parameters:
time
- The time to wait for the lock.timeUnit
- The time's time unit.
-
Global
public Global(int size) Creates a new global circularity lock that does not wait for a release.- Parameters:
size
- The amount of locks used in parallel or0
if no global locks should be used.
-
Global
Creates a new global circularity lock.- Parameters:
size
- The amount of locks used in parallel or0
if no global locks should be used.time
- The time to wait for the lock.timeUnit
- The time's time unit.
-
-
Method Details
-
doAcquire
protected boolean doAcquire()Description copied from class:AgentBuilder.CircularityLock.WithInnerClassLoadingLock
Acquires the actual lock for the current thread.- Specified by:
doAcquire
in classAgentBuilder.CircularityLock.WithInnerClassLoadingLock
- Returns:
true
if the lock was acquired successfully,false
if it is already hold.
-
release
public void release()Releases the circularity lock if it is currently acquired.
-