Package com.sun.enterprise.web.connector.grizzly

Examples of com.sun.enterprise.web.connector.grizzly.AsyncTask


   
    /**
     * Create an instance of <code>AsyncTask</code>
     */
    private AsyncTask newAsyncProcessorTask(){
        AsyncTask asyncTask = new AsyncProcessorTask();
        asyncTask.setAsyncExecutor(newAsyncExecutor(asyncTask))
        return asyncTask;
    }
View Full Code Here


    /**
     * Return an instance of <code>AsyncTask</code>, which is
     * configured and ready to be executed.
     */
    private AsyncTask getAsyncProcessorTask(){
        AsyncTask asyncTask = asyncProcessors.poll();
        if (asyncTask == null) {
            asyncTask = newAsyncProcessorTask();
        } else {
            asyncTask.recycle();
        }
        return asyncTask;
    }
View Full Code Here

     * this handler. Second, this method is invoked once a
     * <code>ProcessorTask</code> needs to be removed from the interrupted queue.
     */
    public void handle(Task task){
       
        AsyncTask apt = null;
        if (task.getType() == Task.PROCESSOR_TASK) {
            apt = getAsyncProcessorTask();
            apt.setProcessorTask((ProcessorTask)task);
            apt.setSelectorThread(task.getSelectorThread());
        }
       
        boolean wasInterrupted = interruptedQueue.remove(apt);
        if ( !wasInterrupted && apt == null) {
            // Try to remove the ProcessorTask itself
            interruptedQueue.remove(task);
        }

        // Last chance to execute asynchronously.
        if ( apt == null ){
            apt = (AsyncTask)task;
        }

        if (apt != null){
            apt.execute();
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.web.connector.grizzly.AsyncTask

Copyright © 2018 www.massapicom. 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.