Tanzu GemFire Distributed Types Java API Reference
Package dev.gemfire.dtype
Interface DCountDownLatch
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidawait()Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted.booleanawait(long timeout, java.util.concurrent.TimeUnit unit)Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time has elapsed.longcountDown()Decrements the count of the latch, releasing all waiting threads if the count reaches zero.voiddestroy()Destroys the countdown latch.longgetCount()Returns the current count.intgetWaiters()Return the number of threads waiting on this countdown latch.java.lang.StringtoString()Returns a string identifying this latch, as well as its state.
-
-
-
Method Detail
-
await
void await()
Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted.If another thread destroys the latch, the awaiting thread will throw a
DTypeException.
-
await
boolean await(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedExceptionCauses the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time has elapsed.If another thread destroys the latch, the awaiting thread will throw a
DTypeException.- Parameters:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
- true if the count reached zero and false if the waiting time elapsed before the count reached zero
- Throws:
java.lang.InterruptedException- if the current thread is interrupted while waiting
-
countDown
long countDown()
Decrements the count of the latch, releasing all waiting threads if the count reaches zero.- Returns:
- the remaining count of the latch
-
getCount
long getCount()
Returns the current count.- Returns:
- the current count
-
destroy
void destroy()
Destroys the countdown latch. This will release any threads that may have been waiting on the latch.
-
getWaiters
int getWaiters()
Return the number of threads waiting on this countdown latch.- Returns:
- the number of threads waiting
-
toString
java.lang.String toString()
Returns a string identifying this latch, as well as its state. Note that the backend object is not locked for this call and the results may not be accurate.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the latch
-
-