FileDocCategorySizeDatePackage
AbstractConnectorAllocator.javaAPI DocGlassfish v2 API6517Fri May 04 22:35:12 BST 2007com.sun.enterprise.resource

AbstractConnectorAllocator

public abstract class AbstractConnectorAllocator extends Object implements ResourceAllocator
An abstract implementation of the ResourceAllocator interface that houses all the common implementation(s) of the various connector allocators. All resource allocators except BasicResourceAllocator extend this abstract implementation
author
Sivakumar Thyagarajan

Fields Summary
protected com.sun.enterprise.PoolManager
poolMgr
protected ResourceSpec
spec
protected javax.resource.spi.ConnectionRequestInfo
reqInfo
protected Subject
subject
protected javax.resource.spi.ManagedConnectionFactory
mcf
protected com.sun.enterprise.deployment.ConnectorDescriptor
desc
protected ClientSecurityInfo
info
protected static final Logger
_logger
Constructors Summary
public AbstractConnectorAllocator()


      
    
public AbstractConnectorAllocator(com.sun.enterprise.PoolManager poolMgr, javax.resource.spi.ManagedConnectionFactory mcf, ResourceSpec spec, Subject subject, javax.resource.spi.ConnectionRequestInfo reqInfo, ClientSecurityInfo info, com.sun.enterprise.deployment.ConnectorDescriptor desc)

        this.poolMgr = poolMgr;
        this.mcf = mcf;
        this.spec = spec;
        this.subject = subject;
        this.reqInfo = reqInfo;
        this.info = info;
        this.desc = desc;
        
    
Methods Summary
public voidcleanup(ResourceHandle h)

        try {
            ManagedConnection mc = (ManagedConnection) h.getResource();
            mc.cleanup();
        } catch (Exception ex) {
            _logger.log(Level.WARNING, "managed_con.cleanup-failed", ex);
            throw new PoolingException(ex.toString(), ex);
        }
    
public voidcloseUserConnection(ResourceHandle resource)

    
        try {
            ManagedConnection mc = (ManagedConnection) resource.getResource();
            mc.cleanup();
        } catch (ResourceException ex) {
            throw new PoolingException(ex);
        }
    
public voiddestroyResource(ResourceHandle resourceHandle)

        throw new UnsupportedOperationException();
    
public voidfillInResourceObjects(ResourceHandle resourceHandle)

        throw new UnsupportedOperationException();
    
public java.util.SetgetInvalidConnections(java.util.Set connectionSet)

        if(mcf instanceof ValidatingManagedConnectionFactory){
            return ((ValidatingManagedConnectionFactory)this.mcf).
                                    getInvalidConnections(connectionSet);
        }
        return null;
    
public java.lang.ObjectgetSharedConnection(ResourceHandle h)

        throw new UnsupportedOperationException();
    
public booleanisConnectionValid(ResourceHandle h)

         HashSet conn = new HashSet();
         conn.add( h.getResource() );
         Set invalids = null;
         try {
             invalids = getInvalidConnections( conn );
         } catch( ResourceException re ) {
             //ignore and continue??
         }
         
	 if ( (invalids != null && invalids.size() > 0)  ||
	         h.hasConnectionErrorOccurred() ) {
	     return false;
	 } 

	 return true;
    
public booleanisTransactional()

        return true;
    
public booleanmatchConnection(ResourceHandle h)

        Set set = new HashSet();
        set.add(h.getResource());
        try {
            ManagedConnection mc = 
                mcf.matchManagedConnections(set, subject, reqInfo);
            return (mc != null);
        } catch (ResourceException ex) {
            return false;
        }
    
public booleanshareableWithinComponent()

        return false;
    
public booleansupportsReauthentication()

        return this.desc.supportsReauthentication();