transaction.delistResource(xaResource, XAResource.TMSUSPEND); } catch (SystemException e) { throw new ResourceException(e); } try {
    public void afterDelivery() throws ResourceException {        if (transaction == null) {            throw new IllegalStateException("Transaction not in progress");        }        if (beforeDeliveryCompleted && messageDelivered) {            try {                transaction.delistResource(xaResource, XAResource.TMSUSPEND);            }            catch (SystemException e) {                throw new ResourceException(e);            }            try {                if (transactionManager.getTransaction() != transaction) {                    throw new IllegalStateException("Transaction is not bound to the current thread");                }                transactionManager.commit();                //transaction.commit();                log.trace("Transaction committed");            }            catch (RollbackException e) {                throw new ResourceException(e);            }            catch (HeuristicMixedException e) {                doRollback(e);            }            catch (HeuristicRollbackException e) {                doRollback(e);            }            catch (SystemException e) {                doRollback(e);            }            finally {                transaction = null;            }        }    }