public void run() { resizeLock.readLock().lock(); try { while (connectionCount < minSize) { ManagedConnectionInfo mci = new ManagedConnectionInfo(managedConnectionFactory, cri); mci.setSubject(subject); ConnectionInfo ci = new ConnectionInfo(mci); try { next.getConnection(ci); } catch (ResourceException e) { return; } boolean added = addToPool(mci); if (!added) { internalReturn(ci, ConnectionReturnAction.DESTROY); return; } } } catch (Throwable t) { log.error("FillTask encountered error in run method", t); } finally { resizeLock.readLock().unlock(); } }
/** * in: non-null connection object, from non-null mcf. * connection object is not associated with a managed connection * out: supplied connection object is assiciated with a non-null ManagedConnection from mcf. */ public void associateConnection(Object connection, ManagedConnectionFactory managedConnectionFactory, ConnectionRequestInfo connectionRequestInfo) throws ResourceException { ManagedConnectionInfo mci = new ManagedConnectionInfo(managedConnectionFactory, connectionRequestInfo); ConnectionInfo ci = new ConnectionInfo(mci); ci.setConnectionHandle(connection); getStack().getConnection(ci); }
public NamedXAResource getNamedXAResource() throws SystemException { try { ManagedConnectionInfo mci = new ManagedConnectionInfo(managedConnectionFactory, null); ConnectionInfo recoveryConnectionInfo = new ConnectionInfo(mci); recoveryStack.getConnection(recoveryConnectionInfo); // For pooled resources, we may now have a new MCI (not the one constructed above). Make sure we use the correct MCI return new NamedXAResourceWithConnectioninfo((NamedXAResource) recoveryConnectionInfo.getManagedConnectionInfo().getXAResource(), recoveryConnectionInfo); } catch (ResourceException e) { throw (SystemException) new SystemException("Could not get XAResource for recovery for mcf: " + name).initCause(e); } }
/** * in: mcf != null, is a deployed mcf * out: useable connection object. */ public Object allocateConnection(ManagedConnectionFactory managedConnectionFactory, ConnectionRequestInfo connectionRequestInfo) throws ResourceException { ManagedConnectionInfo mci = new ManagedConnectionInfo(managedConnectionFactory, connectionRequestInfo); ConnectionInfo ci = new ConnectionInfo(mci); getStack().getConnection(ci); Object connection = ci.getConnectionProxy(); if (connection == null) { connection = ci.getConnectionHandle(); } else { // connection proxy is used only once so we can be notified // by the garbage collector when a connection is abandoned ci.setConnectionProxy(null); } return connection; }
new ManagedConnectionInfo( originalManagedConnectionInfo.getManagedConnectionFactory(), originalManagedConnectionInfo.getConnectionRequestInfo());