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()
          Execute the associated Adapter or GrizzlyAdapter
 boolean finishExecute()
          Resume the connection by commit the Response object.
 AsyncHandler getAsyncHandler()
          Get the AsyncHandler who drive the asynchronous process.
 AsyncTask getAsyncTask()
          Return AsyncTask.
 ProcessorTask getProcessorTask()
          The ProcessorTask used to execute the request processing.
 boolean interrupt()
          Interrupt the ProcessorTask if AsyncFilter has been defined.
protected static ArrayList<AsyncFilter> loadFilters()
          Load the list of AsynchFilter.
 boolean postExecute()
          Resume the connection by commit the Response object.
 boolean preExecute()
          Pre-execute a ProcessorTask by parsing the request line.
 boolean removeAsyncFilter(AsyncFilter asyncFilter)
          Remove an AsyncFilter
 void reset()
          Reset
 void setAsyncHandler(AsyncHandler asyncHandler)
          Set the AsyncHandler who drive the asynchronous process.
 void setAsyncTask(AsyncTask asyncProcessorTask)
          Set the AsyncTask.
 void setProcessorTask(ProcessorTask task)
          Set the ProcessorTask used to execute the request processing.
 
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
Execute the associated Adapter or GrizzlyAdapter

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

postExecute

public boolean postExecute()
                    throws Exception
Resume the connection by commit the Response object.

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

finishExecute

public boolean finishExecute()
                      throws Exception
Resume the connection by commit the Response object.

Specified by:
finishExecute 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

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

setProcessorTask

public void setProcessorTask(ProcessorTask task)
Set the ProcessorTask used to execute the request processing.

Specified by:
setProcessorTask in interface AsyncExecutor
Parameters:
task - a ProcessorTask

getProcessorTask

public ProcessorTask getProcessorTask()
The ProcessorTask used to execute the request processing.

Specified by:
getProcessorTask in interface AsyncExecutor
Returns:
ProcessorTask used to execute the request processing.

loadFilters

protected static ArrayList<AsyncFilter> loadFilters()
Load the list of AsynchFilter.


reset

public void reset()
Reset

Specified by:
reset in interface AsyncExecutor


Copyright © 2012 Oracle Corporation. All Rights Reserved.