private SITransaction getTransactionForDelete () throws ResourceException {
    	
        final String methodName = "getTransactionForDelete";
        if (TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName);
        }

        /*
         * Register a synchronization to drive the deletion of the message on
         * completion
         */

        final SITransaction transaction = getTransaction();

        if (transaction instanceof Synchronization) {

            try {
            	
            	EmbeddableWebSphereTransactionManager transactionManager = EmbeddableTransactionManagerFactory.getTransactionManager();
                final UOWCoordinator coordinator = EmbeddableTransactionManagerFactory.getUOWCurrent().getUOWCoord();
               

                // The inner class here is used to wrap the transaction (which implements
                // Synchronization itself) and to check after completion to see if the
                // transaction was rolled back.
                
                transactionManager.registerSynchronization(coordinator,
                        new Synchronization() {

                            public void beforeCompletion() {

                                // deletegate to the transaction
                                ((Synchronization) transaction)
                                        .beforeCompletion();

                            }

                            public void afterCompletion(int status) {

                                // deletegate to the transaction
                                ((Synchronization) transaction)
                                        .afterCompletion(status);
                                _transactionRolledBack = !(Status.STATUS_COMMITTED == status);

                            }

                        }, EmbeddableTransactionManagerFactory.getTransactionManager().SYNC_TIER_INNER);

            } catch (final Exception exception) {

                FFDCFilter.processException(exception, CLASS_NAME + "."
                        + methodName, FFDC_PROBE_3, this);
                if (TRACE.isEventEnabled()) {
                    SibTr.exception(this, TRACE, exception);
                }
                throw new ResourceException(NLS.getFormattedMessage(
                        "REGISTER_SYNC_CWSIV1202", new Object[] { transaction,
                                exception }, null), exception);

            }

        } else {

            throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
                    "SYNC_CWSIV1203", new Object[] { transaction,
                            Synchronization.class.getName() }, null));

        }

        if (TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName, transaction);
        }

    	return transaction;
    }
private SITransaction getTransactionForDelete ( ) throws ResourceException { final String methodName = "getTransactionForDelete" ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } final SITransaction transaction = getTransaction ( ) ; if ( transaction instanceof Synchronization ) { try { EmbeddableWebSphereTransactionManager transactionManager = EmbeddableTransactionManagerFactory . getTransactionManager ( ) ; final UOWCoordinator coordinator = EmbeddableTransactionManagerFactory . getUOWCurrent ( ) . getUOWCoord ( ) ; transactionManager . registerSynchronization ( coordinator , new Synchronization ( ) { public void beforeCompletion ( ) { ( ( Synchronization ) transaction ) . beforeCompletion ( ) ; } public void afterCompletion ( int status ) { ( ( Synchronization ) transaction ) . afterCompletion ( status ) ; _transactionRolledBack = ! ( Status . STATUS_COMMITTED == status ) ; } } , EmbeddableTransactionManagerFactory . getTransactionManager ( ) . SYNC_TIER_INNER ) ; } catch ( final Exception exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , FFDC_PROBE_3 , this ) ; if ( TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceException ( NLS . getFormattedMessage ( "REGISTER_SYNC_CWSIV1202" , new Object [ ] { transaction , exception } , null ) , exception ) ; } } else { throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( "SYNC_CWSIV1203" , new Object [ ] { transaction , Synchronization . class . getName ( ) } , null ) ) ; } if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName , transaction ) ; } return transaction ; }
This method gets the transaction that can be used for deleting a message (at the beforeDelivery
stage for distributed and in readMessage method for z/os).

@return A transaction to delete a message under
@throws ResourceException
if the transaction could not be obtained.