@ Override public boolean addSync ( ) throws ResourceException { final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "addSync" ) ; } UOWCoordinator uowCoord = mcWrapper . getUOWCoordinator ( ) ; if ( uowCoord == null ) { java . lang . IllegalStateException e = new java . lang . IllegalStateException ( "addSync: illegal state exception. uowCoord is null" ) ; Object [ ] parms = new Object [ ] { "addSync" , e } ; Tr . error ( tc , "ILLEGAL_STATE_EXCEPTION_J2CA0079" , parms ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "addSync" , e ) ; throw e ; } try { if ( mcWrapper . isConnectionSynchronizationProvider ( ) ) { throw new NotSupportedException ( ) ; } /* * This code will remain here just in case we run into this * case. We should not be isEnlistmentDisabled in this code. * * Log a message and return, if isEnlistmentDisabled is true. */ if ( mcWrapper . isEnlistmentDisabled ( ) ) { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Managed connection isEnlistmentDisabled is true." ) ; Tr . debug ( this , tc , "Returning without registering." ) ; } if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "addSync" , false ) ; } return false ; } /* * Use our XATransactionWrapper */ EmbeddableWebSphereTransactionManager tranMgr = mcWrapper . pm . connectorSvc . transactionManager ; tranMgr . registerSynchronization ( uowCoord , this ) ; } catch ( Exception e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ejs.j2c.XATransactionWrapper.addSync" , "237" , this ) ; Object [ ] parms = new Object [ ] { "addSync" , e , "ResourceException" } ; Tr . error ( tc , "REGISTER_WITH_SYNCHRONIZATION_EXCP_J2CA0026" , parms ) ; ResourceException re = new ResourceException ( "addSync: caught Exception" ) ; re . initCause ( e ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "addSync" , e ) ; throw re ; } if ( isTracingEnabled && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "addSync" , true ) ; return true ; }
Register the current object with the Synchronization manager for the current transaction