test_class.declarator: LATCH_NAME = "test"
test_class.modifier: private static final
test_class.original_string: private static final String LATCH_NAME = "test";
test_class.type: String
test_class.var_name: LATCH_NAME
test_class.declarator: STALE_ACK_LOG_MSG = "Latch for this acknowledge is completed or never have existed"
test_class.modifier: private static final
test_class.original_string: private static final String STALE_ACK_LOG_MSG = "Latch for this acknowledge is completed or never have existed";
test_class.type: String
test_class.var_name: STALE_ACK_LOG_MSG
test_class.declarator: ERROR_MSG = Pattern.compile("An error occurred processing the message.*"
          + LatchAckMessage.class.getSimpleName())
test_class.modifier: public static final
test_class.original_string: public static final Pattern ERROR_MSG = Pattern.compile("An error occurred processing the message.*"
          + LatchAckMessage.class.getSimpleName());
test_class.type: Pattern
test_class.var_name: ERROR_MSG
test_class.declarator: gridLogger
test_class.modifier: public
test_class.original_string: public ListeningTestLogger gridLogger;
test_class.type: ListeningTestLogger
test_class.var_name: gridLogger
test_class.file: modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/latch/ExchangeLatchManagerTest.java
test_class.identifier: ExchangeLatchManagerTest
test_class.superclass: extends GridCommonAbstractTest
test_case.body: @Test
      public void shouldCorrectlyExecuteLatchWhenCrdCreatedLast() throws Exception {
          IgniteEx crd = startGrid(0);
          IgniteEx ignite1 = startGrid(1);
          startGrid(2);
  
          //Version which is greater than current.
          AffinityTopologyVersion nextVer = new AffinityTopologyVersion(crd.cluster().topologyVersion() + 1, 0);
  
          //Send ack message from client latch before server latch would be created.
          ignite1.context().io().sendToGridTopic(
              crd.localNode(),
              GridTopic.TOPIC_EXCHANGE,
              new LatchAckMessage(
                  LATCH_NAME, nextVer, false
              ), GridIoPolicy.SYSTEM_POOL
          );
  
          //Current version increase up to nextVer after this event.
          stopGrid(2);
  
          //This latch expected ack only from this node and from ignite1 which already sent it.
          Latch latchCrdOther = latchManager(0).getOrCreate(LATCH_NAME, nextVer);
  
          latchCrdOther.countDown();
          latchCrdOther.await(1, TimeUnit.SECONDS);
      }
test_case.class_method_signature: ExchangeLatchManagerTest.shouldCorrectlyExecuteLatchWhenCrdCreatedLast()
test_case.full_signature: @Test public void shouldCorrectlyExecuteLatchWhenCrdCreatedLast()
test_case.identifier: shouldCorrectlyExecuteLatchWhenCrdCreatedLast
test_case.invocations: startGrid startGrid startGrid topologyVersion cluster sendToGridTopic io context localNode stopGrid getOrCreate latchManager countDown await
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldCorrectlyExecuteLatchWhenCrdCreatedLast()
focal_class.declarator: VERSION_SINCE = IgniteProductVersion.fromString("2.5.0")
focal_class.modifier: private static final
focal_class.original_string: private static final IgniteProductVersion VERSION_SINCE = IgniteProductVersion.fromString("2.5.0");
focal_class.type: IgniteProductVersion
focal_class.var_name: VERSION_SINCE
focal_class.declarator: PROTOCOL_V2_VERSION_SINCE = IgniteProductVersion.fromString("2.5.3")
focal_class.modifier: public static final
focal_class.original_string: public static final IgniteProductVersion PROTOCOL_V2_VERSION_SINCE = IgniteProductVersion.fromString("2.5.3");
focal_class.type: IgniteProductVersion
focal_class.var_name: PROTOCOL_V2_VERSION_SINCE
focal_class.declarator: log
focal_class.modifier: private final
focal_class.original_string: private final IgniteLogger log;
focal_class.type: IgniteLogger
focal_class.var_name: log
focal_class.declarator: ctx
focal_class.modifier: private final
focal_class.original_string: private final GridKernalContext ctx;
focal_class.type: GridKernalContext
focal_class.var_name: ctx
focal_class.declarator: discovery
focal_class.modifier: @GridToStringExclude
      private final
focal_class.original_string: @GridToStringExclude
      private final GridDiscoveryManager discovery;
focal_class.type: GridDiscoveryManager
focal_class.var_name: discovery
focal_class.declarator: io
focal_class.modifier: @GridToStringExclude
      private final
focal_class.original_string: @GridToStringExclude
      private final GridIoManager io;
focal_class.type: GridIoManager
focal_class.var_name: io
focal_class.declarator: crd
focal_class.modifier: @GridToStringExclude
      private volatile
focal_class.original_string: @GridToStringExclude
      private volatile ClusterNode crd;
focal_class.type: ClusterNode
focal_class.var_name: crd
focal_class.declarator: pendingAcks = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<CompletableLatchUid, Set<UUID>> pendingAcks = new ConcurrentHashMap<>();
focal_class.type: ConcurrentMap<CompletableLatchUid, Set<UUID>>
focal_class.var_name: pendingAcks
focal_class.declarator: serverLatches = new ConcurrentHashMap<>()
focal_class.modifier: @GridToStringInclude
      private final
focal_class.original_string: @GridToStringInclude
      private final ConcurrentMap<CompletableLatchUid, ServerLatch> serverLatches = new ConcurrentHashMap<>();
focal_class.type: ConcurrentMap<CompletableLatchUid, ServerLatch>
focal_class.var_name: serverLatches
focal_class.declarator: clientLatches = new ConcurrentHashMap<>()
focal_class.modifier: @GridToStringInclude
      private final
focal_class.original_string: @GridToStringInclude
      private final ConcurrentMap<CompletableLatchUid, ClientLatch> clientLatches = new ConcurrentHashMap<>();
focal_class.type: ConcurrentMap<CompletableLatchUid, ClientLatch>
focal_class.var_name: clientLatches
focal_class.declarator: joinedNodes = new ConcurrentHashMap<>()
focal_class.modifier: @GridToStringExclude
      private final
focal_class.original_string: @GridToStringExclude
      private final ConcurrentMap<AffinityTopologyVersion, ClusterNode> joinedNodes = new ConcurrentHashMap<>();
focal_class.type: ConcurrentMap<AffinityTopologyVersion, ClusterNode>
focal_class.var_name: joinedNodes
focal_class.declarator: lock = new ReentrantLock()
focal_class.modifier: private final
focal_class.original_string: private final ReentrantLock lock = new ReentrantLock();
focal_class.type: ReentrantLock
focal_class.var_name: lock
focal_class.file: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/latch/ExchangeLatchManager.java
focal_class.identifier: ExchangeLatchManager
focal_class.class_method_signature: ExchangeLatchManager.ExchangeLatchManager(GridKernalContext ctx)
focal_class.full_signature: public  ExchangeLatchManager(GridKernalContext ctx)
focal_class.identifier: ExchangeLatchManager
focal_class.modifiers: public
focal_class.parameters: (GridKernalContext ctx)
focal_class.signature:  ExchangeLatchManager(GridKernalContext ctx)
focal_class.class_method_signature: ExchangeLatchManager.createServerLatch(CompletableLatchUid latchUid, Collection<ClusterNode> participants)
focal_class.full_signature: private Latch createServerLatch(CompletableLatchUid latchUid, Collection<ClusterNode> participants)
focal_class.identifier: createServerLatch
focal_class.modifiers: private
focal_class.parameters: (CompletableLatchUid latchUid, Collection<ClusterNode> participants)
focal_class.return: Latch
focal_class.signature: Latch createServerLatch(CompletableLatchUid latchUid, Collection<ClusterNode> participants)
focal_class.class_method_signature: ExchangeLatchManager.createClientLatch(CompletableLatchUid latchUid, ClusterNode coordinator, Collection<ClusterNode> participants)
focal_class.full_signature: private Latch createClientLatch(CompletableLatchUid latchUid, ClusterNode coordinator, Collection<ClusterNode> participants)
focal_class.identifier: createClientLatch
focal_class.modifiers: private
focal_class.parameters: (CompletableLatchUid latchUid, ClusterNode coordinator, Collection<ClusterNode> participants)
focal_class.return: Latch
focal_class.signature: Latch createClientLatch(CompletableLatchUid latchUid, ClusterNode coordinator, Collection<ClusterNode> participants)
focal_class.class_method_signature: ExchangeLatchManager.getOrCreate(String id, AffinityTopologyVersion topVer)
focal_class.full_signature: public Latch getOrCreate(String id, AffinityTopologyVersion topVer)
focal_class.identifier: getOrCreate
focal_class.modifiers: public
focal_class.parameters: (String id, AffinityTopologyVersion topVer)
focal_class.return: Latch
focal_class.signature: Latch getOrCreate(String id, AffinityTopologyVersion topVer)
focal_class.class_method_signature: ExchangeLatchManager.dropLatch(String id, AffinityTopologyVersion topVer)
focal_class.full_signature: public void dropLatch(String id, AffinityTopologyVersion topVer)
focal_class.identifier: dropLatch
focal_class.modifiers: public
focal_class.parameters: (String id, AffinityTopologyVersion topVer)
focal_class.return: void
focal_class.signature: void dropLatch(String id, AffinityTopologyVersion topVer)
focal_class.class_method_signature: ExchangeLatchManager.aliveNodesForTopologyVer(AffinityTopologyVersion topVer)
focal_class.full_signature: private Collection<ClusterNode> aliveNodesForTopologyVer(AffinityTopologyVersion topVer)
focal_class.identifier: aliveNodesForTopologyVer
focal_class.modifiers: private
focal_class.parameters: (AffinityTopologyVersion topVer)
focal_class.return: Collection<ClusterNode>
focal_class.signature: Collection<ClusterNode> aliveNodesForTopologyVer(AffinityTopologyVersion topVer)
focal_class.class_method_signature: ExchangeLatchManager.getLatchParticipants(AffinityTopologyVersion topVer)
focal_class.full_signature: private Collection<ClusterNode> getLatchParticipants(AffinityTopologyVersion topVer)
focal_class.identifier: getLatchParticipants
focal_class.modifiers: private
focal_class.parameters: (AffinityTopologyVersion topVer)
focal_class.return: Collection<ClusterNode>
focal_class.signature: Collection<ClusterNode> getLatchParticipants(AffinityTopologyVersion topVer)
focal_class.class_method_signature: ExchangeLatchManager.excludeJoinedNodes(List<ClusterNode> participantNodes, AffinityTopologyVersion topVer)
focal_class.full_signature: private List<ClusterNode> excludeJoinedNodes(List<ClusterNode> participantNodes, AffinityTopologyVersion topVer)
focal_class.identifier: excludeJoinedNodes
focal_class.modifiers: private
focal_class.parameters: (List<ClusterNode> participantNodes, AffinityTopologyVersion topVer)
focal_class.return: List<ClusterNode>
focal_class.signature: List<ClusterNode> excludeJoinedNodes(List<ClusterNode> participantNodes, AffinityTopologyVersion topVer)
focal_class.class_method_signature: ExchangeLatchManager.getLatchCoordinator(AffinityTopologyVersion topVer)
focal_class.full_signature: @Nullable private ClusterNode getLatchCoordinator(AffinityTopologyVersion topVer)
focal_class.identifier: getLatchCoordinator
focal_class.modifiers: @Nullable private
focal_class.parameters: (AffinityTopologyVersion topVer)
focal_class.return: ClusterNode
focal_class.signature: ClusterNode getLatchCoordinator(AffinityTopologyVersion topVer)
focal_class.class_method_signature: ExchangeLatchManager.canSkipJoiningNodes(AffinityTopologyVersion topVer)
focal_class.full_signature: public boolean canSkipJoiningNodes(AffinityTopologyVersion topVer)
focal_class.identifier: canSkipJoiningNodes
focal_class.modifiers: public
focal_class.parameters: (AffinityTopologyVersion topVer)
focal_class.return: boolean
focal_class.signature: boolean canSkipJoiningNodes(AffinityTopologyVersion topVer)
focal_class.class_method_signature: ExchangeLatchManager.processAck(UUID from, LatchAckMessage message)
focal_class.full_signature: private void processAck(UUID from, LatchAckMessage message)
focal_class.identifier: processAck
focal_class.modifiers: private
focal_class.parameters: (UUID from, LatchAckMessage message)
focal_class.return: void
focal_class.signature: void processAck(UUID from, LatchAckMessage message)
focal_class.class_method_signature: ExchangeLatchManager.becomeNewCoordinator()
focal_class.full_signature: private void becomeNewCoordinator()
focal_class.identifier: becomeNewCoordinator
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void becomeNewCoordinator()
focal_class.class_method_signature: ExchangeLatchManager.processNodeLeft(AffinityTopologyVersion topVer, ClusterNode left)
focal_class.full_signature: private void processNodeLeft(AffinityTopologyVersion topVer, ClusterNode left)
focal_class.identifier: processNodeLeft
focal_class.modifiers: private
focal_class.parameters: (AffinityTopologyVersion topVer, ClusterNode left)
focal_class.return: void
focal_class.signature: void processNodeLeft(AffinityTopologyVersion topVer, ClusterNode left)
focal_class.class_method_signature: ExchangeLatchManager.sendAck(UUID nodeId, CompletableLatchUid latchUid, boolean finalAck)
focal_class.full_signature: private void sendAck(UUID nodeId, CompletableLatchUid latchUid, boolean finalAck)
focal_class.identifier: sendAck
focal_class.modifiers: private
focal_class.parameters: (UUID nodeId, CompletableLatchUid latchUid, boolean finalAck)
focal_class.return: void
focal_class.signature: void sendAck(UUID nodeId, CompletableLatchUid latchUid, boolean finalAck)
focal_class.class_method_signature: ExchangeLatchManager.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_method.body: public Latch getOrCreate(String id, AffinityTopologyVersion topVer) {
          lock.lock();
  
          try {
              final CompletableLatchUid latchUid = new CompletableLatchUid(id, topVer);
  
              CompletableLatch latch = clientLatches.containsKey(latchUid) ?
                  clientLatches.get(latchUid) : serverLatches.get(latchUid);
  
              if (latch != null)
                  return latch;
  
              ClusterNode coordinator = getLatchCoordinator(topVer);
  
              if (coordinator == null)
                  return null;
  
              Collection<ClusterNode> participants = getLatchParticipants(topVer);
  
              return coordinator.isLocal()
                  ? createServerLatch(latchUid, participants)
                  : createClientLatch(latchUid, coordinator, participants);
          }
          finally {
              lock.unlock();
          }
      }
focal_method.class_method_signature: ExchangeLatchManager.getOrCreate(String id, AffinityTopologyVersion topVer)
focal_method.full_signature: public Latch getOrCreate(String id, AffinityTopologyVersion topVer)
focal_method.identifier: getOrCreate
focal_method.invocations: lock containsKey get get getLatchCoordinator getLatchParticipants isLocal createServerLatch createClientLatch unlock
focal_method.modifiers: public
focal_method.parameters: (String id, AffinityTopologyVersion topVer)
focal_method.return: Latch
focal_method.signature: Latch getOrCreate(String id, AffinityTopologyVersion topVer)