FileDocCategorySizeDatePackage
LocalTxConnectorAllocator.javaAPI DocGlassfish v2 API5308Fri May 04 22:35:14 BST 2007com.sun.enterprise.resource

LocalTxConnectorAllocator

public class LocalTxConnectorAllocator extends AbstractConnectorAllocator
author
Tony Ng

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

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

        try {
            ManagedConnection mc =
                mcf.createManagedConnection(subject, reqInfo);
            
            ResourceHandle resource =
                new ResourceHandle(mc, spec, this, info);
            ConnectionEventListener l = 
                new LocalTxConnectionEventListener(resource);
            mc.addConnectionEventListener(l);
            resource.setListener(l);

            XAResource xares = 
                new ConnectorXAResource(resource, spec, this, info);
            resource.fillInResourceObjects(null, xares);

            return resource;
        } catch (ResourceException ex) {
            _logger.log(Level.WARNING,"poolmgr.create_resource_error",ex.getMessage());
            _logger.log(Level.FINE,"Resource Exception while creating resource",ex);

            if (ex.getLinkedException() != null) {
                _logger.log(Level.WARNING,"poolmgr.create_resource_error",ex.getLinkedException().getMessage());
            }
            throw new PoolingException(ex);
        } 
    
public voiddestroyResource(ResourceHandle resource)

        try {
            ManagedConnection mc = (ManagedConnection) resource.getResource();
            ConnectorXAResource.freeListener(mc);
            mc.destroy();
            if (_logger.isLoggable( Level.FINEST ) ) {
                _logger.finest( "destroyResource for LocalTxConnectorAllocator done");
            }

        } 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);

            ConnectorXAResource xares = (ConnectorXAResource) resource.getXAResource();
            xares.setUserHandle(con);
            resource.fillInResourceObjects(con, xares);
        } catch (ResourceException ex) {
            throw new PoolingException(ex);
        }
    
public booleanshareableWithinComponent()

        //For local transactions, a resource is always shareable within components 
	    //within the same transaction
        return true;