private void resetAssociation() throws XAException{ try { ResourceHandle handle = getResourceHandle(); LocalTxConnectionEventListener l = (LocalTxConnectionEventListener)handle.getListener(); //Get all associated Handles and reset their ManagedConnection association. Map associatedHandles = l.getAssociatedHandles(); if(associatedHandles != null ){ Set<Map.Entry> userHandles = associatedHandles.entrySet(); for(Map.Entry userHandleEntry : userHandles ){ ResourceHandle associatedHandle = (ResourceHandle)userHandleEntry.getValue(); ManagedConnection associatedConnection = (ManagedConnection)associatedHandle.getResource(); associatedConnection.associateConnection(userHandleEntry.getKey()); if(_logger.isLoggable(Level.FINE)){ _logger.log(Level.FINE, "connection_sharing_reset_association", userHandleEntry.getKey()); } } //all associated handles are mapped back to their actual Managed Connection. Clear the associations. associatedHandles.clear(); } } catch (Exception ex) { handleResourceException(ex); } }
cl.getManagedConnection().associateConnection(cr.connection); registerAssociation(cl, cr.connection); cr.setConnectionListener(cl);
public void end(Xid xid, int flags) throws XAException { if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "connection_sharing_end"); } try { ResourceHandle handleInTransaction = getResourceHandle(); if (!localHandle_.equals(handleInTransaction)) { LocalTxConnectionEventListener l = (LocalTxConnectionEventListener) handleInTransaction.getListener(); ResourceHandle handle = l.removeAssociation(userHandle); if (handle != null) { // not needed, just to be sure. ManagedConnection associatedConnection = (ManagedConnection) handle.getResource(); associatedConnection.associateConnection(userHandle); if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "connection_sharing_reset_association", userHandle); } } } } catch (Exception e) { handleResourceException(e); } }
public void start(Xid xid, int flags) throws XAException { try { ResourceHandle handle = getResourceHandle(); if (!localHandle_.equals(handle)) { ManagedConnection mc = (ManagedConnection) handle.getResource(); mc.associateConnection(userHandle); LocalTxConnectionEventListener l = (com.sun.enterprise.resource.listener.LocalTxConnectionEventListener) handle.getListener(); if(_logger.isLoggable(Level.FINE)){ _logger.log(Level.FINE, "connection_sharing_start", userHandle); } l.associateHandle(userHandle, localHandle_); } else{ associatedTransaction = getCurrentTransaction(); } } catch (Exception ex) { handleResourceException(ex); } }
_mConn.associateConnection(uConn);
cl.getManagedConnection().associateConnection(connection); registerAssociation(cl, connection);
/** * 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(); }
ManagedConnection dmc = (ManagedConnection) handle.getResource(); dmc.associateConnection(connection); } catch (ResourceException e) { putbackDirectToPool(handle, spec.getPoolInfo());