/** * Enlist if necessary * @return True if a JTA transaction was found, false otherwise. * * @throws AtomikosSQLException */ private boolean enlist() throws AtomikosSQLException { boolean ret = false; try { if ( LOGGER.isTraceEnabled() ) LOGGER.logTrace( this + ": notifyBeforeUse " + sessionHandleState); CompositeTransaction ct = null; CompositeTransactionManager ctm = getCompositeTransactionManager(); if ( ctm != null ) { ct = ctm.getCompositeTransaction(); //first notify the session handle - see case 27857 sessionHandleState.notifyBeforeUse ( ct ); if (ct != null && ct.getProperty ( TransactionManagerImp.JTA_PROPERTY_NAME ) != null ) { ret = true; if ( LOGGER.isTraceEnabled() ) LOGGER.logTrace ( this + ": detected transaction " + ct ); if ( ct.getState().equals(TxState.ACTIVE) ) ct.registerSynchronization(new JdbcRequeueSynchronization( this , ct )); else AtomikosSQLException.throwAtomikosSQLException("The transaction has timed out - try increasing the timeout if needed"); } } } catch (InvalidSessionHandleStateException ex) { AtomikosSQLException.throwAtomikosSQLException ( ex.getMessage() , ex); } return ret; }