Ejemplo n.º 1
0
 /** 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();
   }
 }
Ejemplo n.º 2
0
  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();
    }
  }
Ejemplo n.º 3
0
  /**
   * 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();
    }
  }