Interface IgniteCountDownLatch
- 
- All Superinterfaces:
- AutoCloseable,- Closeable
 
 public interface IgniteCountDownLatch extends Closeable This interface provides a rich API for working with distributed count down latch.FunctionalityDistributed count down latch provides functionality similar tojava.util.CountDownLatch. Note that you cannot remove count down latch having count greater that zero. It should be counted down to zero first.Creating Distributed Count Down LatchInstance of cache count down latch can be created by calling the following method:Ignite.countDownLatch(String, int, boolean, boolean).
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanautoDelete()GetsautoDeleteflag.voidawait()Causes the current thread to wait until the latch has counted down to zero, unless current thread is interrupted.booleanawait(long timeout)Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time elapses.booleanawait(long timeout, 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 elapses.voidclose()Removes this count down latch.intcount()Gets current count value of the latch.intcountDown()Decrements the count of the latch, releasing all waiting threads on all nodes if the count reaches zero.intcountDown(int val)Decreases the count of the latch using passed in value, releasing all waiting threads on all nodes if the count reaches zero.voidcountDownAll()Counts down this latch to zero, releasing all waiting threads on all nodes.intinitialCount()Gets initial count value of the latch.Stringname()Gets name of the latch.booleanremoved()Getsremovedstatus of the latch.
 
- 
- 
- 
Method Detail- 
nameString name() Gets name of the latch.- Returns:
- Name of the latch.
 
 - 
countint count() Gets current count value of the latch.- Returns:
- Current count.
 
 - 
initialCountint initialCount() Gets initial count value of the latch.- Returns:
- Initial count.
 
 - 
autoDeleteboolean autoDelete() GetsautoDeleteflag. If this flag istruelatch is removed from cache when it has been counted down to 0.- Returns:
- Value of autoDeleteflag.
 
 - 
awaitvoid await() throws IgniteExceptionCauses the current thread to wait until the latch has counted down to zero, unless current thread is interrupted.If the current count of the latch is zero then this method returns immediately. If the current count is greater than zero then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happen: - The count reaches zero due to invocations of the
      countDown()method on any node; or
- Some other thread interrupts the current thread.
 If the current thread: - has its interrupted status set on entry to this method; or
- is interrupted while waiting,
 IgniteInterruptedCheckedExceptionis thrown and the current thread's interrupted status is cleared.- Throws:
- IgniteException- If operation failed.
- IgniteInterruptedException- if the current thread is interrupted while waiting
 
- The count reaches zero due to invocations of the
      
 - 
awaitboolean await(long timeout) throws IgniteExceptionCauses the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time elapses.If the current count is zero then this method returns immediately with the value true.If the current count is greater than zero then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happen: - The count reaches zero due to invocations of the
      countDown()method on any node; or
- Some other thread interrupts the current thread; or
- The specified waiting time elapses.
 If the count reaches zero then the method returns with the value true.If the current thread: - has its interrupted status set on entry to this method; or
- is interrupted while waiting,
 IgniteInterruptedCheckedExceptionis thrown and the current thread's interrupted status is cleared.If the specified waiting time elapses then the value falseis returned. If the time is less than or equal to zero, the method will not wait at all.- Parameters:
- timeout- The maximum time to wait in milliseconds.
- Returns:
- Trueif the count reached zero and- falseif the waiting time elapsed before the count reached zero.
- Throws:
- IgniteInterruptedException- If the current thread is interrupted while waiting.
- IgniteException- If operation failed.
 
- The count reaches zero due to invocations of the
      
 - 
awaitboolean await(long timeout, TimeUnit unit) throws IgniteExceptionCauses the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time elapses.If the current count is zero then this method returns immediately with the value true.If the current count is greater than zero then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happen: - The count reaches zero due to invocations of the
      countDown()method on any node; or
- Some other thread interrupts the current thread; or
- The specified waiting time elapses.
 If the count reaches zero then the method returns with the value true.If the current thread: - has its interrupted status set on entry to this method; or
- is interrupted while waiting,
 IgniteInterruptedCheckedExceptionis thrown and the current thread's interrupted status is cleared.If the specified waiting time elapses then the value falseis returned. If the time is less than or equal to zero, the method will not wait at all.- Parameters:
- timeout- The maximum time to wait.
- unit- The time unit of the- timeoutargument.
- Returns:
- Trueif the count reached zero and- falseif the waiting time elapsed before the count reached zero.
- Throws:
- IgniteInterruptedException- If the current thread is interrupted while waiting.
- IgniteException- If operation failed.
 
- The count reaches zero due to invocations of the
      
 - 
countDownint countDown() throws IgniteExceptionDecrements the count of the latch, releasing all waiting threads on all nodes if the count reaches zero.If the current count is greater than zero then it is decremented. If the new count is zero then all waiting threads are re-enabled for thread scheduling purposes. If the current count equals zero then nothing happens. - Returns:
- Count after decrement.
- Throws:
- IgniteException- If operation failed.
 
 - 
countDownint countDown(int val) throws IgniteExceptionDecreases the count of the latch using passed in value, releasing all waiting threads on all nodes if the count reaches zero.If the current count is greater than zero then it is decreased. If the new count is zero then all waiting threads are re-enabled for thread scheduling purposes. If the current count equals zero then nothing happens. - Parameters:
- val- Value to decrease counter on.
- Returns:
- Count after decreasing.
- Throws:
- IgniteException- If operation failed.
 
 - 
countDownAllvoid countDownAll() throws IgniteExceptionCounts down this latch to zero, releasing all waiting threads on all nodes.If the current count equals zero then nothing happens. - Throws:
- IgniteException- If operation failed.
 
 - 
removedboolean removed() Getsremovedstatus of the latch.- Returns:
- Trueif latch was removed from cache,- falseotherwise.
 
 - 
closevoid close() Removes this count down latch.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IgniteException- If operation failed.
 
 
- 
 
-