src/java/org/apache/cassandra/service/StorageService.java
/**
     * Handle node preparing to leave the ring
     *
     * @param endpoint node
     * @param pieces STATE_LEAVING,token
     */
Handle node preparing to leave the ring
@param endpoint node
@param pieces STATE_LEAVING,token
Handle node preparing to leave the ring @param endpoint node @param pieces STATE_LEAVING token
private void handleStateLeaving(InetAddress endpoint, String[] pieces)
    {
        assert pieces.length >= 2;
        String moveValue = pieces[1];
        Token token = getPartitioner().getTokenFactory().fromString(moveValue);
        if (logger_.isDebugEnabled())
            logger_.debug("Node " + endpoint + " state leaving, token " + token);
        if (!tokenMetadata_.isMember(endpoint))
        {
            logger_.info("Node " + endpoint + " state jump to leaving");
            tokenMetadata_.updateNormalToken(token, endpoint);
        }
        else if (!tokenMetadata_.getToken(endpoint).equals(token))
        {
            logger_.warn("Node " + endpoint + " 'leaving' token mismatch. Long network partition?");
            tokenMetadata_.updateNormalToken(token, endpoint);
        }
        tokenMetadata_.addLeavingEndpoint(endpoint);
        calculatePendingRanges();
    }
private void handleStateLeaving ( InetAddress endpoint , String [ ] pieces ) { assert pieces . length >= 2 ; String moveValue = pieces [ 1 ] ; Token token = getPartitioner ( ) . getTokenFactory ( ) . fromString ( moveValue ) ; if ( logger_ . isDebugEnabled ( ) ) logger_ . debug ( "Node " + endpoint + " state leaving, token " + token ) ; if ( ! tokenMetadata_ . isMember ( endpoint ) ) { logger_ . info ( "Node " + endpoint + " state jump to leaving" ) ; tokenMetadata_ . updateNormalToken ( token , endpoint ) ; } else if ( ! tokenMetadata_ . getToken ( endpoint ) . equals ( token ) ) { logger_ . warn ( "Node " + endpoint + " 'leaving' token mismatch. Long network partition?" ) ; tokenMetadata_ . updateNormalToken ( token , endpoint ) ; } tokenMetadata_ . addLeavingEndpoint ( endpoint ) ; calculatePendingRanges ( ) ; }
Handle node preparing to leave the ring
 @param endpoint node
 @param pieces STATE_LEAVING,token
Handle node preparing to leave the ring @param endpoint node @param pieces STATE_LEAVING token
// If the node is previously unknown or tokens do not match, update tokenmetadata to // have this node as 'normal' (it must have been using this token before the // leave). This way we'll get pending ranges right. // at this point the endpoint is certainly a member with this token, so let's proceed // normally