public void runL1UpdateIfPossible ( InternalCacheEntry ice ) { try { if ( ice != null ) { Object key ; if ( sync . attemptUpdateToRunning ( ) && ! dc . containsKey ( ( key = ice . getKey ( ) ) ) ) { // Acquire the transfer lock to ensure that we don't have a rehash and change to become an owner, // note we check the ownership in following if stateTransferLock . acquireSharedTopologyLock ( ) ; try { // Now we can update the L1 if there isn't a value already there and we haven't now become a write // owner if ( ! dc . containsKey ( key ) && ! cdl . getCacheTopology ( ) . isWriteOwner ( key ) ) { log . tracef ( "Caching remotely retrieved entry for key %s in L1" , toStr ( key ) ) ; long lifespan = ice . getLifespan ( ) < 0 ? l1Lifespan : Math . min ( ice . getLifespan ( ) , l1Lifespan ) ; // Make a copy of the metadata stored internally, adjust // lifespan/maxIdle settings and send them a modification Metadata newMetadata = ice . getMetadata ( ) . builder ( ) . lifespan ( lifespan ) . maxIdle ( - 1 ) . build ( ) ; dc . put ( key , ice . getValue ( ) , new L1Metadata ( newMetadata ) ) ; } else { log . tracef ( "Data container contained value after rehash for key %s" , key ) ; } } finally { stateTransferLock . releaseSharedTopologyLock ( ) ; } } } } finally { sync . innerSet ( ice ) ; } }
Attempts to the L1 update and set the value . If the L1 update was marked as being skipped this will instead just set the value to release blockers . A null value can be provided which will not run the L1 update but will just alert other waiters that a null was given .