public TokenMetadata cloneAfterAllSettled ( ) { lock . readLock ( ) . lock ( ) ; try { TokenMetadata metadata = cloneOnlyTokenMap ( ) ; for ( InetAddress endpoint : leavingEndpoints ) metadata . removeEndpoint ( endpoint ) ; for ( Pair < Token , InetAddress > pair : movingEndpoints ) metadata . updateNormalToken ( pair . left , pair . right ) ; return metadata ; } finally { lock . readLock ( ) . unlock ( ) ; } }
Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all current leave and move operations have finished .