public final void commit ( final CacheEntry entry , final Flag operation , int segment , boolean l1Only , InvocationContext ctx ) { if ( trace ) { log . tracef ( "Trying to commit. Key=%s. Operation Flag=%s, L1 write/invalidation=%s" , toStr ( entry . getKey ( ) ) , operation , l1Only ) ; } if ( l1Only || ( operation == null && ! trackStateTransfer && ! trackXSiteStateTransfer ) ) { //track == null means that it is a normal put and the tracking is not enabled! //if it is a L1 invalidation, commit without track it. if ( trace ) { log . tracef ( "Committing key=%s. It is a L1 invalidation or a normal put and no tracking is enabled!" , toStr ( entry . getKey ( ) ) ) ; } commitEntry ( entry , segment , ctx ) ; return ; } if ( isTrackDisabled ( operation ) ) { //this a put for state transfer but we are not tracking it. This means that the state transfer has ended //or canceled due to a clear command. if ( trace ) { log . tracef ( "Not committing key=%s. It is a state transfer key but no track is enabled!" , toStr ( entry . getKey ( ) ) ) ; } return ; } tracker . compute ( entry . getKey ( ) , ( o , discardPolicy ) -> { if ( discardPolicy != null && discardPolicy . ignore ( operation ) ) { if ( trace ) { log . tracef ( "Not committing key=%s. It was already overwritten! Discard policy=%s" , toStr ( entry . getKey ( ) ) , discardPolicy ) ; } return discardPolicy ; } commitEntry ( entry , segment , ctx ) ; DiscardPolicy newDiscardPolicy = calculateDiscardPolicy ( operation ) ; if ( trace ) { log . tracef ( "Committed key=%s. Old discard policy=%s. New discard policy=%s" , toStr ( entry . getKey ( ) ) , discardPolicy , newDiscardPolicy ) ; } return newDiscardPolicy ; } ) ; }
It tries to commit the cache entry . The entry is not committed if it is originated from state transfer and other operation already has updated it .