org.apache.ignite.internal.processors.cache.distributed.dht.preloader.latch

## Class ExchangeLatchManager

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.distributed.dht.preloader.latch.ExchangeLatchManager

    public class ExchangeLatchManager
    extends Object

Class is responsible to create and manage instances of distributed latches `Latch`.

### Field Summary

Fields
`static IgniteProductVersion` `PROTOCOL_V2_VERSION_SINCE` Exchange latch V2 protocol introduces following optimization: Joining nodes are explicitly excluded from possible latch participants.

### Constructor Summary

Constructors
Constructor and Description
`ExchangeLatchManager(GridKernalContext ctx)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `canSkipJoiningNodes(AffinityTopologyVersion topVer)` Checks that latch manager can use V2 protocol and skip joining nodes from latch participants.
`void` `dropClientLatches(AffinityTopologyVersion topVer)` Drops client latches created by `getOrCreate(String, AffinityTopologyVersion)`.
`Latch` `getOrCreate(String id, AffinityTopologyVersion topVer)` Creates new latch with specified `id` and `topVer` or returns existing latch.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### PROTOCOL_V2_VERSION_SINCE

    public static final IgniteProductVersion PROTOCOL_V2_VERSION_SINCE

Exchange latch V2 protocol introduces following optimization: Joining nodes are explicitly excluded from possible latch participants.

### Constructor Detail

#### ExchangeLatchManager

    public ExchangeLatchManager(GridKernalContext ctx)

Constructor.

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### getOrCreate

    public Latch getOrCreate(String id,
                             AffinityTopologyVersion topVer)

Creates new latch with specified `id` and `topVer` or returns existing latch. Participants of latch are calculated from given `topVer` as alive server nodes. If local node is coordinator `ServerLatch` instance will be created, otherwise `ClientLatch` instance.

Parameters:
  `id` - Latch id.
  `topVer` - Latch topology version.
Returns:
  Latch instance.

#### dropClientLatches

    public void dropClientLatches(AffinityTopologyVersion topVer)

Drops client latches created by `getOrCreate(String, AffinityTopologyVersion)`. The corresponding latches should be created before this method is invoked.

This method must be called when it is guaranteed that all nodes have processed the latches messages. In the context of partitions map exchange this can be done when exchange future is completed.

Parameters:
  `topVer` - Latch topology version.

#### canSkipJoiningNodes

    public boolean canSkipJoiningNodes(AffinityTopologyVersion topVer)

Checks that latch manager can use V2 protocol and skip joining nodes from latch participants.

Parameters:
  `topVer` - Topology version.
Throws:
  `IgniteException` - If nodes for the given `topVer` cannot be found in the discovery history.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023