FileDocCategorySizeDatePackage
LocalTxConnectionEventListener.javaAPI DocGlassfish v2 API4770Thu Jul 19 03:02:58 BST 2007com.sun.enterprise.resource

LocalTxConnectionEventListener

public class LocalTxConnectionEventListener extends ConnectionEventListener
author
Binod P.G

Fields Summary
private com.sun.enterprise.PoolManager
poolMgr
private IdentityHashMap
associatedHandles
private ResourceHandle
resource
Constructors Summary
public LocalTxConnectionEventListener(ResourceHandle resource)

        this.resource = resource;
        this.associatedHandles = new IdentityHashMap(10);
        this.poolMgr = Switch.getSwitch().getPoolManager();
    
Methods Summary
public voidassociateHandle(java.lang.Object c, ResourceHandle h)

        associatedHandles.put(c, h);
    
public voidbadConnectionClosed(ConnectionEvent evt)
Resource adapters will signal that the connection being closed is bad.

param
evt ConnectionEvent

        Object connectionHandle = evt.getConnectionHandle();
        ResourceHandle handle = resource;
        if (associatedHandles.containsKey(connectionHandle)) {
            handle = (ResourceHandle) associatedHandles.get(connectionHandle);
        }
        ManagedConnection mc = (ManagedConnection) evt.getSource();
        mc.removeConnectionEventListener(this);

        poolMgr.badResourceClosed(handle); 
    
public voidconnectionClosed(ConnectionEvent evt)

        Object connectionHandle = evt.getConnectionHandle();
        ResourceHandle handle = resource;
        if (associatedHandles.containsKey(connectionHandle)) {
            handle = (ResourceHandle) associatedHandles.get(connectionHandle);
        }
        poolMgr.resourceClosed(handle); 
    
public voidconnectionErrorOccurred(ConnectionEvent evt)

        resource.setConnectionErrorOccurred();
        ManagedConnection mc = (ManagedConnection) evt.getSource();
        mc.removeConnectionEventListener(this);
	    poolMgr.resourceErrorOccurred( resource );
        try {
            mc.destroy();
        } catch (Exception ex) {
            // ignore exception
        }
    
public java.util.MapgetAssociatedHandles()

        return associatedHandles;
    
public voidlocalTransactionCommitted(ConnectionEvent evt)

         // no-op
    
public voidlocalTransactionRolledback(ConnectionEvent evt)

        // no-op
    
public voidlocalTransactionStarted(ConnectionEvent evt)

            // no-op
    
public ResourceHandleremoveAssociation(java.lang.Object c)

        return (ResourceHandle) associatedHandles.remove(c);