private final void complete ( boolean reUse , Transaction transaction ) throws ObjectManagerException { final String methodName = "complete" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { new Boolean ( reUse ) , transaction } ) ; // No longer any need to include this transaction in a Checkpoint. requiresPersistentCheckpoint = false ; // Clear any remaining state. logicalUnitOfWork . XID = null ; transactionLock = new TransactionLock ( this ) ; includedManagedObjects . clear ( ) ; callbackTokens . clear ( ) ; allPersistentTokensToNotify . clear ( ) ; loggedSerializedBytes . clear ( ) ; logSequenceNumbers . clear ( ) ; managedObjectSequenceNumbers . clear ( ) ; useCount ++ ; if ( reUse ) { // Reset the transaction for further use. // Note that we do not clear the transactionReference because the caller is still holding it. // If the caller releases his reference then the reference will be found by ObjectManagerState // and this InternalTransaction may be reused for another external Transaction. } else { // Do not chain. // Make sure the external Transaction cannot reach this internal one. transaction . internalTransaction = objectManagerState . dummyInternalTransaction ; // This may not be sufficient to prevent its being used if the external Transaction already has passed // the point where it has picked up the referenece to the Internaltransaction. Hence we terminate the // InternalTransaction if it is preemptively backed out. See ObjectManagerstate.performCheckpoint() // where transactions are backed out without holding the internal transaction synchronize lock. if ( transactionReference != null ) transactionReference . clear ( ) ; // Inhibt an enqueue of the transactionReference. // If a reference is enqueued we are already in inactive state for this // transactionReferenceSequence so no action will occur. // Tell the ObjectManager that we no longer exist as an active transaction. objectManagerState . deRegisterTransaction ( this ) ; } // if (reUse). if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Tidy up after Commit or Backout have finished all work for this InternalTransaction .