com.sun.grizzly.arp
Class DefaultAsyncExecutor

java.lang.Object
  extended by com.sun.grizzly.arp.DefaultAsyncExecutor
All Implemented Interfaces:
AsyncExecutor

public class DefaultAsyncExecutor
extends Object
implements AsyncExecutor

Default implementation of the AsyncExecutor. This class will execute a ProcessorTask asynchronously, by interrupting the process based on the logic defined in its associated AsyncFilter If no AsyncFilter are defined, the ProcessorTask will not be interrupted and executed synchronously.

Author:
Jeanfrancois Arcand

Constructor Summary
DefaultAsyncExecutor()
           
 
Method Summary
 void addAsyncFilter(AsyncFilter asyncFilter)
          Add an AsyncFilter
 boolean execute()
          Interrupt the ProcessorTask if AsyncFilter has been defined.
 AsyncHandler getAsyncHandler()
          Get the AsyncHandler who drive the asynchronous process.
 AsyncTask getAsyncTask()
          Return AsyncTask.
 boolean interrupt()
          Interrupt the ProcessorTask if AsyncFilter has been defined.
protected static void loadFilters()
          Load the list of AsynchFilter.
 boolean postExecute()
          Post-execute the ProcessorTask by preparing the response, flushing the response and then close or keep-alive the connection.
 boolean preExecute()
          Pre-execute a ProcessorTask by parsing the request line.
 boolean removeAsyncFilter(AsyncFilter asyncFilter)
          Remove an AsyncFilter
 void setAsyncHandler(AsyncHandler asyncHandler)
          Set the AsyncHandler who drive the asynchronous process.
 void setAsyncTask(AsyncTask asyncProcessorTask)
          Set the AsyncTask.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAsyncExecutor

public DefaultAsyncExecutor()
Method Detail

preExecute

public boolean preExecute()
                   throws Exception
Pre-execute a ProcessorTask by parsing the request line.

Specified by:
preExecute in interface AsyncExecutor
Returns:
true if the processing can continue.
Throws:
Exception

interrupt

public boolean interrupt()
                  throws Exception
Interrupt the ProcessorTask if AsyncFilter has been defined.

Specified by:
interrupt in interface AsyncExecutor
Returns:
true if the execution can continue, false if delayed.
Throws:
Exception

execute

public boolean execute()
                throws Exception
Interrupt the ProcessorTask if AsyncFilter has been defined.

Specified by:
execute in interface AsyncExecutor
Returns:
true if the execution can continue, false if delayed.
Throws:
Exception

postExecute

public boolean postExecute()
                    throws Exception
Post-execute the ProcessorTask by preparing the response, flushing the response and then close or keep-alive the connection.

Specified by:
postExecute in interface AsyncExecutor
Returns:
true if the processing can continue.
Throws:
Exception

setAsyncTask

public void setAsyncTask(AsyncTask asyncProcessorTask)
Set the AsyncTask.

Specified by:
setAsyncTask in interface AsyncExecutor

getAsyncTask

public AsyncTask getAsyncTask()
Return AsyncTask.

Specified by:
getAsyncTask in interface AsyncExecutor

loadFilters

protected static void loadFilters()
Load the list of AsynchFilter.


addAsyncFilter

public void addAsyncFilter(AsyncFilter asyncFilter)
Add an AsyncFilter

Specified by:
addAsyncFilter in interface AsyncExecutor

removeAsyncFilter

public boolean removeAsyncFilter(AsyncFilter asyncFilter)
Remove an AsyncFilter

Specified by:
removeAsyncFilter in interface AsyncExecutor

getAsyncHandler

public AsyncHandler getAsyncHandler()
Get the AsyncHandler who drive the asynchronous process.

Specified by:
getAsyncHandler in interface AsyncExecutor

setAsyncHandler

public void setAsyncHandler(AsyncHandler asyncHandler)
Set the AsyncHandler who drive the asynchronous process.

Specified by:
setAsyncHandler in interface AsyncExecutor


Copyright © 2009 SUN Microsystems. All Rights Reserved.