protected void optimisticReplaceBackout ( Transaction transaction , ObjectManagerByteArrayOutputStream serializedBytes , long savedSequenceNumber , boolean requiresCurrentCheckpoint ) throws ObjectManagerException { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "optimisticReplaceBackout" , new Object [ ] { transaction , serializedBytes , new Long ( savedSequenceNumber ) , new Boolean ( requiresCurrentCheckpoint ) } ) ; // The compensation logic for the optimistic update will correct the backed out update, // we now need to give this corrected state to the ObjectStore. setState ( nextStateForOptimisticReplaceBackout ) ; synchronized ( forcedUpdateSequenceLock ) { if ( savedSequenceNumber > forcedUpdateSequence ) { forcedUpdateSequence = savedSequenceNumber ; // The serializedBytes we have been passed are the ones we are left with after any compensating // action has been performed, for eacmple at preBackout time. // Did we commit an OptimisticReplace after some other transaction has subsequently deleted us. if ( state != stateDeleted ) { // Thread 2 in the scenario in optimisticReplaceCommit above. // Some other thread has deleted this ManagedObject and commited its transaction. latestSerializedBytes = serializedBytes ; owningToken . objectStore . add ( this , requiresCurrentCheckpoint ) ; } // if (state != stateDeleted). } // if (savesSequenceNumber > forcedUpdateSequence). } // synchronized (forcedUpdateSequenceLock). // No unlocking to do since the object is not locked for OptimisticReplace. if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "optimisticReplaceBackout" ) ; }
Driven when the ManageObject is backed out after an optimistic replace within a transaction .