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

ConnectorAllocator

public class ConnectorAllocator extends AbstractConnectorAllocator
author
Tony Ng

Fields Summary
private boolean
shareable
Constructors Summary
public ConnectorAllocator(com.sun.enterprise.PoolManager poolMgr, ManagedConnectionFactory mcf, ResourceSpec spec, Subject subject, ConnectionRequestInfo reqInfo, ClientSecurityInfo info, com.sun.enterprise.deployment.ConnectorDescriptor desc, boolean shareable)

        super(poolMgr, mcf, spec, subject, reqInfo, info, desc);
        this.shareable = shareable;
    
Methods Summary
public ResourceHandlecreateResource()

        try {
            ManagedConnection mc =
                mcf.createManagedConnection(subject, reqInfo);
            
            ResourceHandle resource =
                new ResourceHandle(mc, spec, this, info);
            ConnectionEventListener l = 
                new ConnectionListenerImpl(resource);
            mc.addConnectionEventListener(l);
            return resource;
        } catch (ResourceException ex) {
            throw new PoolingException(ex);
        }
    
public voiddestroyResource(ResourceHandle resource)


        try {
            closeUserConnection(resource);
        } catch (Exception ex) {
            // ignore error
        }
        
        try {
            ManagedConnection mc = (ManagedConnection) resource.getResource();
            mc.destroy();
        } catch (Exception ex) {
            _logger.log(Level.WARNING, ex.getMessage());
            throw new PoolingException(ex);
        }

    
public voidfillInResourceObjects(ResourceHandle resource)

        try {
	    ManagedConnection mc = (ManagedConnection) resource.getResource();
	    Object con = mc.getConnection( subject, reqInfo );
	    resource.incrementCount();
            XAResource xares = mc.getXAResource();
            resource.fillInResourceObjects(con, xares);
        } catch( ResourceException ex ) {
	    throw new PoolingException( ex );
	}
    
public booleanshareableWithinComponent()

        return shareable;