/** * To get the connection to work with. * * @return Connection The connection to work on. Any statement that is * created will have a default timeout of 60 seconds. It is * recommended that a timeout is used in any case, in order to avoid * blocking rollbacks! */ public Connection getConnection () throws SQLException { return getConnection ( null ); }
public void connectionClosed ( ConnectionEvent e ) { ResourceTransaction restx = unsetResourceTransaction (); suspendResourceTransaction ( restx ); setDiscarded (); ConnectionEvent e2 = new ConnectionEvent ( this ); Enumeration enumm = listeners_.elements (); while ( enumm.hasMoreElements () ) { ConnectionEventListener l = (ConnectionEventListener) enumm .nextElement (); l.connectionClosed ( e2 ); } }
public void connectionErrorOccurred ( ConnectionEvent e ) { ResourceTransaction restx = unsetResourceTransaction (); suspendResourceTransaction ( restx ); setInvalidated (); ConnectionEvent e2 = new ConnectionEvent ( this, e.getSQLException () ); Enumeration enumm = listeners_.elements (); while ( enumm.hasMoreElements () ) { ConnectionEventListener l = (ConnectionEventListener) enumm .nextElement (); l.connectionErrorOccurred ( e2 ); } }
/** * @see javax.sql.ConnectionPoolDataSource#getPooledConnection(java.lang.String, * java.lang.String) */ public PooledConnection getPooledConnection ( String user , String pw ) throws SQLException { PooledConnection ret = null; checkSetup (); XAConnection xaconn = xads_.getXAConnection ( user, pw ); ret = new ExternalXAPooledConnectionImp ( xaconn, getTransactionalResource (), getLogWriter () ); return ret; }
protected void setDiscarded () { discarded_ = true; connectionProxy_ = null; // before reusing the connection, // make sure that the restx association // is cleared; to avoid mixing the work // of different txs! unsetResourceTransaction (); }
public synchronized void setResourceTransaction ( ResourceTransaction restx ) throws SQLException { // System.out.println ( "setResourceTransaction"); super.setResourceTransaction ( restx ); try { // add synchronization to current CT. // NOTE: since we are only reusable AFTER termination // of the CT, we can not add ourselves as synchronization // more than once -> GOOD, otherwise we would have // dangerous behaviour (multiple terminated notifications // would mess up reused connections!) // System.out.println ( "registering synchronization" ); CompositeTransaction ct = Configuration .getCompositeTransactionManager () .getCompositeTransaction (); ct.registerSynchronization ( this ); afterCompletionDone_ = false; // added: needed for reuse of aborts (beforecompletion not called!) } catch ( Exception e ) { AtomikosSQLException.throwAtomikosSQLException ( e.getMessage() , e ); } }
/** * @see javax.sql.ConnectionPoolDataSource#getPooledConnection() */ public PooledConnection getPooledConnection () throws SQLException { checkSetup (); PooledConnection ret = null; XAConnection xaconn = xads_.getXAConnection (); ret = new ExternalXAPooledConnectionImp ( xaconn, getTransactionalResource (), getLogWriter () ); return ret; }
ret = new ExternalXAPooledConnectionImp ( conn, getTransactionalResource (), getLogWriter () ); } else {