@HashCodeAndEqualsPlugin.Enhance public static class AgentBuilder.CircularityLock.Global extends java.lang.Object implements AgentBuilder.CircularityLock
AgentBuilder.CircularityLock.Default, AgentBuilder.CircularityLock.Global, AgentBuilder.CircularityLock.Inactive| Modifier and Type | Field and 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.
|
| Constructor and Description |
|---|
Global()
Creates a new global circularity lock that does not wait for a release.
|
Global(long time,
java.util.concurrent.TimeUnit timeUnit)
Creates a new global circularity lock.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
acquire()
Attempts to acquire a circularity lock.
|
void |
release()
Releases the circularity lock if it is currently acquired.
|
private final java.util.concurrent.locks.Lock lock
private final long time
private final java.util.concurrent.TimeUnit timeUnit
public Global()
public Global(long time,
java.util.concurrent.TimeUnit timeUnit)
time - The time to wait for the lock.timeUnit - The time's time unit.public boolean acquire()
acquire in interface AgentBuilder.CircularityLocktrue if the lock was acquired successfully, false if it is already hold.public void release()
release in interface AgentBuilder.CircularityLock