![](../icons/Hazelcast-IMDG-Logo-Orange_Dark_200px.jpg) | ICountDownLatch Interface |
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.9.4
Syntaxpublic interface ICountDownLatch : IDistributedObject
Public Interface ICountDownLatch
Inherits IDistributedObject
public interface class ICountDownLatch : IDistributedObject
type ICountDownLatch =
interface
interface IDistributedObject
end
The ICountDownLatch type exposes the following members.
Methods
| Name | Description |
---|
![Public method Public method](../icons/pubmethod.gif) | 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.
|
![Public method Public method](../icons/pubmethod.gif) | CountDown |
Decrements the count of the latch, releasing all waiting threads if
the count reaches zero.
|
![Public method Public method](../icons/pubmethod.gif) | Destroy | Destroys this object cluster-wide. (Inherited from IDistributedObject.) |
![Public method Public method](../icons/pubmethod.gif) | GetCount | Returns the current count. |
![Public method Public method](../icons/pubmethod.gif) | GetName | Returns the unique name for this IDistributedObject. (Inherited from IDistributedObject.) |
![Public method Public method](../icons/pubmethod.gif) | GetPartitionKey | Returns the key of partition this IDistributedObject is assigned to. (Inherited from IDistributedObject.) |
![Public method Public method](../icons/pubmethod.gif) | GetServiceName | Returns the service name for this object. (Inherited from IDistributedObject.) |
![Public method Public method](../icons/pubmethod.gif) | TrySetCount | Sets the count to the given value if the current count is zero. |
Top
See Also