@Test public void shouldTestGetLockReturnsSameObjectByName() { Lock lock = STANDALONE_CLUESTER_CONTEXT.getLock("testLock"); assertNotNull(lock); assertEquals(lock, STANDALONE_CLUESTER_CONTEXT.getLock("testLock")); }
@Override public Lock getLock(String name) { Lock lock = locks.get(name); if (lock == null) { lock = new ReentrantLock(); Lock oldLock = locks.putIfAbsent(name, lock); if (oldLock != null) { lock = oldLock; } } return lock; }
StandaloneClusterContext implements ClusterContext { @Override public Lock getLock(String name) { Lock lock = locks.get(name); if (lock == null) { lock = new ReentrantLock(); Lock oldLock = locks.putIfAbsent(name, lock); if (oldLock != null) { lock = oldLock; } } return lock; } }
StandaloneClusterContext implements ClusterContext { @Override public Lock getLock(String name) { Lock lock = locks.get(name); if (lock == null) { lock = new ReentrantLock(); Lock oldLock = locks.putIfAbsent(name, lock); if (oldLock != null) { lock = oldLock; } } return lock; } StandaloneClusterContext(); }
StandaloneClusterContext implements ClusterContext { @Override public Lock getLock(String name) { Lock lock = locks.get(name); if (lock == null) { lock = new ReentrantLock(); Lock oldLock = locks.putIfAbsent(name, lock); if (oldLock != null) { lock = oldLock; } } return lock; } StandaloneClusterContext(); @Override void addMembershipEventListener(MembershipEventListener eventListener); @Override void removeMembershipEventListener(MembershipEventListener eventListener); @Override String getClusterName(); @Override List<MemberId> getMemberIds(); @Override List<MemberId> getAccepts(); @Override List<MemberId> getConnects(); @Override ClusterConnectOptionsContext getConnectOptions(); @Override MemberId getLocalMember(); @Override String getInstanceKey(MemberId memberId); @Override Lock getLock(String name); @Override void start(); @Override void dispose(); @Override CollectionsFactory getCollectionsFactory(); @Override void logClusterState(); @Override void logClusterStateAtInfoLevel(); @Override ITopic<E> getTopic(String name); }
StandaloneClusterContext implements ClusterContext { @Override public Lock getLock(String name) { Lock lock = locks.get(name); if (lock == null) { lock = new ReentrantLock(); Lock oldLock = locks.putIfAbsent(name, lock); if (oldLock != null) { lock = oldLock; } } return lock; } StandaloneClusterContext(); @Override void addMembershipEventListener(MembershipEventListener eventListener); @Override void removeMembershipEventListener(MembershipEventListener eventListener); @Override String getClusterName(); @Override List<MemberId> getMemberIds(); @Override List<MemberId> getAccepts(); @Override List<MemberId> getConnects(); @Override ClusterConnectOptionsContext getConnectOptions(); @Override MemberId getLocalMember(); @Override String getInstanceKey(MemberId memberId); @Override Lock getLock(String name); @Override void start(); @Override void dispose(); @Override CollectionsFactory getCollectionsFactory(); @Override void logClusterState(); @Override void logClusterStateAtInfoLevel(); @Override ITopic<E> getTopic(String name);  }