Examples of ResourceHandle


Examples of com.sun.enterprise.resource.ResourceHandle

     * @param resourceAllocator ResourceAllocator
     * @return ResourceHandle newly created resource
     * @throws PoolingException when unable create a resource
     */
    protected ResourceHandle createSingleResource(ResourceAllocator resourceAllocator) throws PoolingException {
        ResourceHandle resourceHandle;
        int count = 0;
        long startTime = 0;
        while (true) {
            try {
                count++;
                startTime = System.currentTimeMillis();
                resourceHandle = resourceAllocator.createResource();
                if(_logger.isLoggable(Level.FINE)) {
                    _logger.log(Level.FINE, "Time taken to create a single "
                            + "resource : "
                            + resourceHandle.getResourceSpec().getResourceId()
                            + " and adding to the pool (ms) : "
                            + (System.currentTimeMillis() - startTime));
                }
                if (validation || validateAtmostEveryIdleSecs)
                    resourceHandle.setLastValidated(System.currentTimeMillis());
                break;
            } catch (Exception ex) {
                if(_logger.isLoggable(Level.FINE)) {
                    _logger.log(Level.FINE, "Connection creation failed for " + count + " time. It will be retried, "
                        + "if connection creation retrial is enabled.", ex);
View Full Code Here

Examples of com.sun.enterprise.resource.ResourceHandle

    }


    public ResourceHandle createResource(ResourceAllocator alloc) throws PoolingException {
        //NOTE : Pool should not call this method directly, it should be called only by pool-datastructure
        ResourceHandle result = createSingleResource(alloc);

        ResourceState state = new ResourceState();
        state.setBusy(false);
        state.setEnlisted(false);
        result.setResourceState(state);

        if (poolLifeCycleListener != null) {
            poolLifeCycleListener.connectionCreated();
        }
        return result;
View Full Code Here

Examples of com.sun.enterprise.resource.ResourceHandle

    public void emptyFreeConnectionsInPool() {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "Emptying free connections in pool : " + poolInfo);
        }

        ResourceHandle h;
        while ((h = ds.getResource()) != null) {
            ds.removeResource(h);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.resource.ResourceHandle

     * be called
     */
    private void killExtraResources(int numToKill) {
        cancelResizerTask();

        ResourceHandle h;
        for (int i = 0; i < numToKill && ((h = ds.getResource()) != null); i++) {
            ds.removeResource(h);
        }
        scheduleResizerTask();
    }
View Full Code Here

Examples of com.sun.enterprise.resource.ResourceHandle

    }

    @Override
    protected ResourceHandle getUnenlistedResource(ResourceSpec spec, ResourceAllocator alloc,
            Transaction tran) throws PoolingException {
        ResourceHandle handle = null;

        if(incrementPoolSize()){
            try{
                handle = createSingleResource(alloc);
            }catch (PoolingException ex){
                decrementPoolSize();
                throw ex;
            }
            ResourceState state = new ResourceState();
            handle.setResourceState(state);
            state.setEnlisted(false);
            setResourceStateToBusy(handle);
            return handle;
        }
        _logger.info("Fail as poolSize : " + poolSize);
View Full Code Here

Examples of com.sun.enterprise.resource.ResourceHandle

                    "EndpointFactory is currently not available");
        }

        MessageEndpoint endpoint = null;
        try {
            ResourceHandle resourceHandle = allocator_.createResource(xaResource);

            MessageBeanListener listener =
                    messageBeanPM_.createMessageBeanListener(resourceHandle);

            //Use the MDB's application classloader to load the
View Full Code Here

Examples of com.sun.enterprise.resource.ResourceHandle

            throws PoolingException {
        try {
            ManagedConnection mc =
                    mcf.createManagedConnection(subject, reqInfo);

            ResourceHandle resource =
                    createResourceHandle(mc, spec, this, info);
            ConnectionEventListener l =
                    new ConnectionListenerImpl(resource);
            mc.addConnectionEventListener(l);
            return resource;
View Full Code Here

Examples of com.sun.enterprise.resource.ResourceHandle

    public ResourceHandle createResource()
            throws PoolingException {
        try {
            ManagedConnection mc =
                    mcf.createManagedConnection(subject, reqInfo);
            ResourceHandle resource =
                    createResourceHandle(mc, spec, this, info);
            ConnectionEventListener l =
                    new ConnectionListenerImpl(resource);
            mc.addConnectionEventListener(l);
            return resource;
View Full Code Here

Examples of com.sun.enterprise.resource.ResourceHandle

            _logger.log(Level.WARNING,"unable_to_determine_pool_type", spec.getPoolInfo());
        }
        if (pt == ConnectorConstants.PoolType.ASSOCIATE_WITH_THREAD_POOL) {
            return new AssocWithThreadResourceHandle(resource, spec, alloc, info);
        } else {
            return new ResourceHandle(resource, spec, alloc, info);
        }
    }
View Full Code Here

Examples of org.apache.xbean.classloader.ResourceHandle

        }

        List<URL> urls = new ArrayList<URL>();
        for (ResourceLocation location : boundClassPath)
        {
            ResourceHandle resourceHandle = location.getResourceHandle(resourceName);
            if (resourceHandle != null)
            {
                urls.add(resourceHandle.getUrl());
            }
        }
        if (!urls.isEmpty()) return Collections.enumeration(urls);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.