src/java/org/apache/cassandra/service/StorageService.java
/**
     * Handle notification that a node being actively removed from the ring via 'removetoken'
     *
     * @param endpoint node
     * @param pieces either REMOVED_TOKEN (node is gone) or REMOVING_TOKEN (replicas need to be restored)
     */
Handle notification that a node being actively removed from the ring via 'removetoken'
@param endpoint node
@param pieces either REMOVED_TOKEN (node is gone) or REMOVING_TOKEN (replicas need to be restored)
Handle notification that a node being actively removed from the ring via ' removetoken ' @param endpoint node @param pieces either REMOVED_TOKEN ( node is gone ) or REMOVING_TOKEN ( replicas need to be restored )
private void handleStateRemoving(InetAddress endpoint, String[] pieces)
    {
        assert (pieces.length > 0);
        if (endpoint.equals(FBUtilities.getBroadcastAddress()))
        {
            logger_.info("Received removeToken gossip about myself. Is this node rejoining after an explicit removetoken?");
            try
            {
                drain();
            }
            catch (Exception e)
            {
                throw new RuntimeException(e);
            }
            return;
        }
        if (tokenMetadata_.isMember(endpoint))
        {
            String state = pieces[0];
            Token removeToken = tokenMetadata_.getToken(endpoint);
            if (VersionedValue.REMOVED_TOKEN.equals(state))
            {
                excise(removeToken, endpoint, extractExpireTime(pieces));
            }
            else if (VersionedValue.REMOVING_TOKEN.equals(state))
            {
                if (logger_.isDebugEnabled())
                    logger_.debug("Token " + removeToken + " removed manually (endpoint was " + endpoint + ")");
                tokenMetadata_.addLeavingEndpoint(endpoint);
                calculatePendingRanges();
                String[] coordinator = Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.REMOVAL_COORDINATOR).value.split(VersionedValue.DELIMITER_STR, -1);
                Token coordtoken = getPartitioner().getTokenFactory().fromString(coordinator[1]);
                restoreReplicaCount(endpoint, tokenMetadata_.getEndpoint(coordtoken));
            }
        } 
    }
private void handleStateRemoving ( InetAddress endpoint , String [ ] pieces ) { assert ( pieces . length > 0 ) ; if ( endpoint . equals ( FBUtilities . getBroadcastAddress ( ) ) ) { logger_ . info ( "Received removeToken gossip about myself. Is this node rejoining after an explicit removetoken?" ) ; try { drain ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return ; } if ( tokenMetadata_ . isMember ( endpoint ) ) { String state = pieces [ 0 ] ; Token removeToken = tokenMetadata_ . getToken ( endpoint ) ; if ( VersionedValue . REMOVED_TOKEN . equals ( state ) ) { excise ( removeToken , endpoint , extractExpireTime ( pieces ) ) ; } else if ( VersionedValue . REMOVING_TOKEN . equals ( state ) ) { if ( logger_ . isDebugEnabled ( ) ) logger_ . debug ( "Token " + removeToken + " removed manually (endpoint was " + endpoint + ")" ) ; tokenMetadata_ . addLeavingEndpoint ( endpoint ) ; calculatePendingRanges ( ) ; String [ ] coordinator = Gossiper . instance . getEndpointStateForEndpoint ( endpoint ) . getApplicationState ( ApplicationState . REMOVAL_COORDINATOR ) . value . split ( VersionedValue . DELIMITER_STR , - 1 ) ; Token coordtoken = getPartitioner ( ) . getTokenFactory ( ) . fromString ( coordinator [ 1 ] ) ; restoreReplicaCount ( endpoint , tokenMetadata_ . getEndpoint ( coordtoken ) ) ; } } }
Handle notification that a node being actively removed from the ring via 'removetoken'
 @param endpoint node
 @param pieces either REMOVED_TOKEN (node is gone) or REMOVING_TOKEN (replicas need to be restored)
Handle notification that a node being actively removed from the ring via ' removetoken ' @param endpoint node @param pieces either REMOVED_TOKEN ( node is gone ) or REMOVING_TOKEN ( replicas need to be restored )
// Note that the endpoint is being removed // find the endpoint coordinating this removal that we need to notify when we're done // grab any data we are now responsible for and notify responsible node // not a member, nothing to do