public ManagedPoolItem(ConnectionPool cm, ManagedConnectionFactory mcf, ManagedConnection conn) { _cm = cm; _id = _cm.generateId(); _mcf = mcf; _mConn = conn; _poolStartTime = Alarm.getCurrentTime(); _poolEventTime = Alarm.getCurrentTime(); _connectionStartTime = cm.getConnectionTimeProbe().start(); // Gets the resource object from the driver try { if (cm.isXATransaction()) { XAResource xaResource = conn.getXAResource(); try { _defaultTransactionTimeout = xaResource.getTransactionTimeout(); } catch (Throwable e) { log.log(Level.FINE, e.toString(), e); } _xaResource = xaResource; } } catch (NotSupportedException e) { _cm.setXATransaction(false); log.log(Level.FINER, e.toString(), e); } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } if (_xaResource == null) _isXATransaction = false; // Gets the local transaction from the driver try { if (_cm.isLocalTransaction()) _localTransaction = conn.getLocalTransaction(); } catch (NotSupportedException e) { _cm.setLocalTransaction(false); log.log(Level.FINER, e.toString(), e); } catch (Exception e) { log.log(Level.FINER, e.toString(), e); } _mConn.addConnectionEventListener(this); if (log.isLoggable(Level.FINE)) log.fine( "create: " + this + "(active:" + _cm.getConnectionActiveCount() + ", total:" + _cm.getConnectionCount() + ")"); }
@Override public int getTransactionTimeout() throws XAException { return xaResource.getTransactionTimeout(); }