com.sun.grizzly.arp
Class DefaultAsyncHandler

java.lang.Object
  extended by com.sun.grizzly.arp.DefaultAsyncHandler
All Implemented Interfaces:
AsyncHandler

public class DefaultAsyncHandler
extends Object
implements AsyncHandler

Default implementation of AsyncHandler. This class handle the aysnchronous execution of a ProcessorTask. The request processing is executed by doing: (1) Wrap the ProcessorTask using an instance of AsyncTask (2) Execute the AsyncTask using the wrapped ProcessorTask ExecutorService (3) If the AsyncTask has been interrupted but ready to be removed from the interrupted queue, remove it and execute the remaining operations.

Author:
Jeanfrancois Arcand

Constructor Summary
DefaultAsyncHandler()
           
 
Method Summary
 void addAsyncFilter(AsyncFilter asyncFilter)
          Add an AsyncFilter
 void handle(Task task)
          Handle an instance of a Task.
protected  AsyncExecutor newAsyncExecutor(AsyncTask asyncTask)
          Create an instance of DefaultAsyncExecutor
 boolean removeAsyncFilter(AsyncFilter asyncFilter)
          Remove an AsyncFilter
 void returnTask(AsyncTask asyncTask)
          Return th Task to the pool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAsyncHandler

public DefaultAsyncHandler()
Method Detail

newAsyncExecutor

protected AsyncExecutor newAsyncExecutor(AsyncTask asyncTask)
Create an instance of DefaultAsyncExecutor


handle

public void handle(Task task)
Handle an instance of a Task. This method is invoked first by a ProcessorTask, which delegate its execution to this handler. This method will uses an AsyncTask to start the execution of the defined AsyncFilter.

Specified by:
handle in interface AsyncHandler

returnTask

public void returnTask(AsyncTask asyncTask)
Return th Task to the pool

Specified by:
returnTask in interface AsyncHandler

addAsyncFilter

public void addAsyncFilter(AsyncFilter asyncFilter)
Add an AsyncFilter

Specified by:
addAsyncFilter in interface AsyncHandler

removeAsyncFilter

public boolean removeAsyncFilter(AsyncFilter asyncFilter)
Remove an AsyncFilter

Specified by:
removeAsyncFilter in interface AsyncHandler


Copyright © 2012 Oracle Corporation. All Rights Reserved.