Methods Summary |
---|
public void | doTask()Execute the AsyncExecutor based on the stage
of the ProcessorTask execution.
boolean contineExecution = true;
while ( contineExecution ) {
try{
switch(stage){
case AsyncTask.PRE_EXECUTE:
stage = AsyncTask.INTERRUPTED;
contineExecution = asyncExecutor.preExecute();
break;
case AsyncTask.INTERRUPTED:
stage = AsyncTask.POST_EXECUTE;
contineExecution = asyncExecutor.interrupt();
break;
case AsyncTask.EXECUTE:
contineExecution = asyncExecutor.execute();
stage = AsyncTask.POST_EXECUTE;
break;
case AsyncTask.POST_EXECUTE:
contineExecution = asyncExecutor.postExecute();
stage = AsyncTask.COMPLETED;
break;
}
} catch (Throwable t){
SelectorThread.logger().log(Level.SEVERE,t.getMessage(),t);
if ( stage <= AsyncTask.INTERRUPTED) {
// We must close the connection.
stage = AsyncTask.POST_EXECUTE;
} else {
stage = AsyncTask.COMPLETED;
throw new RuntimeException(t);
}
} finally {
// If the execution is completed, return this task to the pool.
if ( stage == AsyncTask.COMPLETED){
stage = AsyncTask.PRE_EXECUTE;
asyncExecutor.getAsyncHandler().returnTask(this);
}
}
}
|
public com.sun.enterprise.web.connector.grizzly.AsyncExecutor | getAsyncExecutor()Get the AsyncExecutor .
return asyncExecutor;
|
public com.sun.enterprise.web.connector.grizzly.ProcessorTask | getProcessorTask()Return the ProcessorTask .
return processorTask;
|
public int | getStage()Return the stage of the current execution.
return stage;
|
public void | recycle()Reset the object.
stage = AsyncTask.PRE_EXECUTE;
processorTask = null;
|
public void | setAsyncExecutor(com.sun.enterprise.web.connector.grizzly.AsyncExecutor asyncExecutor)Set the AsyncExecutor used by this Task
to delegate the execution of a ProcessorTask .
this.asyncExecutor = asyncExecutor;
|
public void | setProcessorTask(com.sun.enterprise.web.connector.grizzly.ProcessorTask processorTask)Set the ProcessorTask that needs to be executed
asynchronously.
this.processorTask = processorTask;
if ( pipeline == null && processorTask != null) {
setPipeline(processorTask.getPipeline());
}
|
public void | setStage(int stage)
this.stage = stage;
|
public void | taskEvent(com.sun.enterprise.web.connector.grizzly.TaskEvent event)Not used.
|