Code example for CountDownLatch

import org.hornetq.api.core.client.TopologyMember; 
final class BackupTopologyListener implements ClusterTopologyListener 
   private final CountDownLatch latch = new CountDownLatch(1);
   private final String ownId;
   private static final int WAIT_TIMEOUT = 60;
   public BackupTopologyListener(String ownId)
      this.ownId = ownId;
   public void nodeUP(TopologyMember topologyMember, boolean last)
      final String nodeID = topologyMember.getNodeId();
      if (ownId.equals(nodeID) && topologyMember.getBackup() != null)
Connect your IDE to all the code out there  Get Codota for Java