ICountDownLatch is a backed-up distributed alternative to the
.
ICountDownLatch is a cluster-wide synchronization aid
that allows one or more threads to wait until a set of operations being
performed in other threads completes.
There are a few differences compared to the
ICountDownLatch
:
- the ICountDownLatch count can be re-set using TrySetCount(int) after a countdown has finished but not during an active count. This allows the same latch instance to be reused.
- there is no await() method to do an unbound wait since this is undesirable in a distributed application: it can happen that for example a cluster is split or that the master and replica's all die. So in most cases it is best to configure an explicit timeout so have the ability to deal with these situations.
Namespace: Hazelcast.Core
Assembly: Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.6.3.0
Syntax
The ICountDownLatch type exposes the following members.
Methods
Name | Description | |
---|---|---|
Await |
Causes the current thread to wait until the latch has counted down to
zero, an exception is thrown, or the specified waiting time elapses.
| |
CountDown |
Decrements the count of the latch, releasing all waiting threads if
the count reaches zero.
| |
Destroy | Destroys this object cluster-wide. (Inherited from IDistributedObject.) | |
GetCount | Returns the current count. | |
GetName | Returns the unique name for this IDistributedObject. (Inherited from IDistributedObject.) | |
GetPartitionKey | Returns the key of partition this IDistributedObject is assigned to. (Inherited from IDistributedObject.) | |
GetServiceName | Returns the service name for this object. (Inherited from IDistributedObject.) | |
TrySetCount | Sets the count to the given value if the current count is zero. |
See Also