Class ConditionLatch
java.lang.Object
de.aristaflow.adept2.util.locking.ConditionLatch
This is similar to a normal
CountDownLatch but
it uses a wrapped lock for synchronising as well as a new corresponding
condition for signalling. This allows to have a latch that releases a lock
when waiting for the latch.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConditionLatch(Lock lock) Creates a new latch with the designated latch and a count of 1.ConditionLatch(Lock lock, long count) Creates a new latch with the designated latch and the designated count. -
Method Summary
-
Field Details
-
lock
The lock which to use for synchronising. -
cond
The condition on which to wait for the latch. -
count
protected long countThe number of releases before this latch releases threads.
-
-
Constructor Details
-
ConditionLatch
Creates a new latch with the designated latch and a count of 1.- Parameters:
lock- The lock with which to synchronise access to this latch.
-
ConditionLatch
Creates a new latch with the designated latch and the designated count.- Parameters:
lock- The lock with which to synchronise access to this latch.count- The number of releases before this latch releases threads.
-
-
Method Details
-
await
- Throws:
InterruptedException- See Also:
-
await
- Throws:
InterruptedException- See Also:
-
countDown
public void countDown()- See Also:
-
getCount
public long getCount()- See Also:
-