public boolean securityMatches(ManagedConnectionInfo other) { return ( subject == null ? other.getSubject() == null : subject.equals(other.getSubject())) && (connectionRequestInfo == null ? other.getConnectionRequestInfo() == null : connectionRequestInfo.equals(other.getConnectionRequestInfo())); }
.matchManagedConnections(pool.keySet(), mci.getSubject(), mci.getConnectionRequestInfo()); if (matchedMC != null) { connectionInfo.setManagedConnectionInfo(pool.get(matchedMC));
public FillTask(ConnectionInfo connectionInfo) { managedConnectionFactory = connectionInfo.getManagedConnectionInfo().getManagedConnectionFactory(); subject = connectionInfo.getManagedConnectionInfo().getSubject(); cri = connectionInfo.getManagedConnectionInfo().getConnectionRequestInfo(); }
public void getConnection(ConnectionInfo connectionInfo) throws ResourceException { ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo(); SubjectCRIKey key = new SubjectCRIKey( useSubject ? mci.getSubject() : null, useCRI ? mci.getConnectionRequestInfo() : null); ConnectionInterceptor poolInterceptor = null; synchronized (pools) { if (destroyed) { throw new ResourceException("ConnectionManaged has been destroyed"); } poolInterceptor = (ConnectionInterceptor) pools.get(key); if (poolInterceptor == null) { poolInterceptor = singlePoolFactory.addPoolingInterceptors(next); pools.put(key, (PoolingAttributes) poolInterceptor); } } poolInterceptor.getConnection(connectionInfo); connectionInfo.getManagedConnectionInfo().setPoolInterceptor(poolInterceptor); }
public void getConnection(ConnectionInfo connectionInfo) throws ResourceException { if (connectionInfo.isUnshareable()) { next.getConnection(connectionInfo); return; } ManagedConnectionInfo managedConnectionInfo = connections.get(); if (managedConnectionInfo != null) { if (matchConnections) { ManagedConnectionInfo mciRequest = connectionInfo.getManagedConnectionInfo(); if (null != managedConnectionInfo.getManagedConnectionFactory().matchManagedConnections( Collections.singleton(managedConnectionInfo.getManagedConnection()), mciRequest.getSubject(), mciRequest.getConnectionRequestInfo() )) { connectionInfo.setManagedConnectionInfo(managedConnectionInfo); return; } else { //match failed, get a new cx after returning this one connections.set(null); next.returnConnection(connectionInfo, ConnectionReturnAction.RETURN_HANDLE); } } else { connectionInfo.setManagedConnectionInfo(managedConnectionInfo); return; } } //nothing for this thread or match failed next.getConnection(connectionInfo); connections.set(connectionInfo.getManagedConnectionInfo()); }
public void getConnection(ConnectionInfo connectionInfo) throws ResourceException { ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo(); if (mci.getManagedConnection() != null) { return; } try { ManagedConnection mc = mci.getManagedConnectionFactory().createManagedConnection( mci.getSubject(), mci.getConnectionRequestInfo()); mci.setManagedConnection(mc); GeronimoConnectionEventListener listener = new GeronimoConnectionEventListener(stack, mci); mci.setConnectionEventListener(listener); mc.addConnectionEventListener(listener); } catch (ResourceException re) { log.error("Error occurred creating ManagedConnection for " + connectionInfo, re); throw re; } }
matchedMC = newMCI.getManagedConnectionFactory().matchManagedConnections(Collections.singleton(newMCI.getManagedConnection()), mci.getSubject(), mci.getConnectionRequestInfo()); } catch (ResourceException e) {
/** * in: connectionInfo not null, managedConnectionInfo not null. ManagedConnection may or may not be null. ConnectionHandle may or may not be null * out: managedConnection not null. connection handle not null. managedConnectionInfo has connection handle registered. Connection handle is associated with ManagedConnection. * @param connectionInfo * @throws ResourceException */ public void getConnection(ConnectionInfo connectionInfo) throws ResourceException { next.getConnection(connectionInfo); ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo(); if (connectionInfo.getConnectionHandle() == null) { connectionInfo.setConnectionHandle( mci.getManagedConnection().getConnection( mci.getSubject(), mci.getConnectionRequestInfo())); mci.addConnectionHandle(connectionInfo); } else if (!mci.hasConnectionInfo(connectionInfo)) { mci.getManagedConnection().associateConnection( connectionInfo.getConnectionHandle()); mci.addConnectionHandle(connectionInfo); } connectionInfo.setTrace(); }
new ManagedConnectionInfo( originalManagedConnectionInfo.getManagedConnectionFactory(), originalManagedConnectionInfo.getConnectionRequestInfo()); newManagedConnectionInfo.setSubject(currentSubject); connectionInfo.setManagedConnectionInfo(newManagedConnectionInfo);