public TokenMetadata cachedOnlyTokenMap ( ) { TokenMetadata tm = cachedTokenMap . get ( ) ; if ( tm != null ) return tm ; // synchronize to prevent thundering herd (CASSANDRA-6345) synchronized ( this ) { if ( ( tm = cachedTokenMap . get ( ) ) != null ) return tm ; tm = cloneOnlyTokenMap ( ) ; cachedTokenMap . set ( tm ) ; return tm ; } }
Return a cached TokenMetadata with only tokenToEndpointMap i . e . the same as cloneOnlyTokenMap but uses a cached copy that is invalided when the ring changes so in the common case no extra locking is required .