public void pop() { try { ISrvSmartTran trn = SrvApiAlgs2.getIServerTran(); trn.close(); IPooledConnection pool = ApiStack.getApi().getIntfImplementor(IPooledConnection.class); Connection con = ApiStack.getApi().getIntfImplementor(Connection.class); try { pool.returnConnection(con); } catch (Throwable t) { ApiAlgs.getLog(this).error("Error returning connection", t); } } finally { ApiStack.popApi(); } }
public void push() { ISrvPrepSqlGetter sqlGetter = (ISrvPrepSqlGetter) ApiStack.queryInterface(ISrvPrepSqlGetter.class); IPooledConnection pool = ApiStack.getApi().getIntfImplementor(IPooledConnection.class); try { Connection con = pool.getPooledConnection(); Api api = new Api(); api.setIntfImplementor(Connection.class, con); ApiStack.pushApi(api); api.setIntfImplementor(ISrvSmartTran.class, new SrvSmartTran(con, sqlGetter)); } catch (SQLException e) { ApiAlgs.rethrowException(e); } }