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
Fields Modifier and Type Field Description private java.util.concurrent.locks.Lock
lock
The lock to hold.private long
time
The time to wait for the lock.private java.util.concurrent.TimeUnit
timeUnit
The time's time unit.-
Fields inherited from class net.bytebuddy.agent.builder.AgentBuilder.CircularityLock.WithInnerClassLoadingLock
DEFAULT_SIZE
-
-
Constructor Summary
Constructors Constructor Description 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(int size)
Creates a new global circularity lock that does not wait for a release.Global(int size, long time, java.util.concurrent.TimeUnit timeUnit)
Creates a new global circularity lock.Global(long time, java.util.concurrent.TimeUnit timeUnit)
Creates a new global circularity lock with a default size for the amount of global locks.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
doAcquire()
Acquires the actual lock for the current thread.void
release()
Releases the circularity lock if it is currently acquired.-
Methods inherited from class net.bytebuddy.agent.builder.AgentBuilder.CircularityLock.WithInnerClassLoadingLock
acquire
-
-
-
-
Constructor Detail
-
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
public Global(long time, java.util.concurrent.TimeUnit timeUnit)
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
public Global(int size, long time, java.util.concurrent.TimeUnit timeUnit)
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 Detail
-
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.
-
-