class ExchangeLatchManager {

    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();
        }
    }

    public  ExchangeLatchManager(GridKernalContext ctx);

}