/** used by tests */ public void clearUnsafe() { lock.writeLock().lock(); try { bootstrapTokens.clear(); tokenToEndpointMap.clear(); topology.clear(); leavingEndpoints.clear(); pendingRanges.clear(); endpointToHostIdMap.clear(); invalidateCachedRings(); } finally { lock.writeLock().unlock(); } }
public void removeEndpoint(InetAddress endpoint) { assert endpoint != null; lock.writeLock().lock(); try { bootstrapTokens.removeValue(endpoint); tokenToEndpointMap.removeValue(endpoint); topology.removeEndpoint(endpoint); leavingEndpoints.remove(endpoint); endpointToHostIdMap.remove(endpoint); sortedTokens = sortTokens(); invalidateCachedRings(); } finally { lock.writeLock().unlock(); } }
/** * Remove pair of token/address from moving endpoints * * @param endpoint address of the moving node */ public void removeFromMoving(InetAddress endpoint) { assert endpoint != null; lock.writeLock().lock(); try { for (Pair<Token, InetAddress> pair : movingEndpoints) { if (pair.right.equals(endpoint)) { movingEndpoints.remove(pair); break; } } invalidateCachedRings(); } finally { lock.writeLock().unlock(); } }