Fields Summary |
---|
private static final String | ASYNC_FILTER |
private com.sun.enterprise.web.connector.grizzly.AsyncTask | asyncProcessorTaskThe AsyncTask used to wrap the
ProcessorTask |
private com.sun.enterprise.web.connector.grizzly.ProcessorTask | processorTaskThe associated ProcessorTask |
private static String[] | sharedAsyncFiltersThe AsyncFilter to execute asynchronous operations on
a ProcessorTask . |
private ArrayList | asyncFiltersThe AsyncFilter to execute asynchronous operations on
a ProcessorTask . |
private boolean | invokeFilterDo we need to invoke filters? |
private com.sun.enterprise.web.connector.grizzly.AsyncHandler | asyncHandlerThe AsyncHandler associated with this object. |
Methods Summary |
---|
public void | addAsyncFilter(com.sun.enterprise.web.connector.grizzly.AsyncFilter asyncFilter)Add an AsyncFilter
asyncFilters.add(asyncFilter);
|
public boolean | execute()Interrupt the ProcessorTask if AsyncFilter
has been defined.
processorTask.invokeAdapter();
return true;
|
public com.sun.enterprise.web.connector.grizzly.AsyncHandler | getAsyncHandler()Get the AsyncHandler who drive the asynchronous process.
return asyncHandler;
|
public com.sun.enterprise.web.connector.grizzly.AsyncTask | getAsyncTask()Return AsyncTask .
return asyncProcessorTask;
|
private void | init()
if (sharedAsyncFilters != null){
for (String filterName: sharedAsyncFilters){
asyncFilters.add(loadInstance(filterName));
}
}
|
public boolean | interrupt()Interrupt the ProcessorTask if AsyncFilter
has been defined.
if ( asyncFilters == null || asyncFilters.size() == 0 ) {
execute();
return false;
} else {
asyncHandler.addToInterruptedQueue(asyncProcessorTask);
return invokeFilters();
}
|
private boolean | invokeFilters()Invoke the AsyncFilter
boolean continueExec = true;
for (AsyncFilter asf: asyncFilters){
continueExec = asf.doFilter(this);
if ( !continueExec ){
break;
}
}
return continueExec;
|
protected static void | loadFilters()Load the list of AsynchFilter .
if ( System.getProperty(ASYNC_FILTER) != null){
StringTokenizer st = new StringTokenizer(
System.getProperty(ASYNC_FILTER),",");
sharedAsyncFilters = new String[st.countTokens()];
int i = 0;
while (st.hasMoreTokens()){
sharedAsyncFilters[i++] = st.nextToken();
}
}
|
private static com.sun.enterprise.web.connector.grizzly.AsyncFilter | loadInstance(java.lang.String property)Instanciate a class based on a property.
Class className = null;
try{
className = Class.forName(property);
return (AsyncFilter)className.newInstance();
} catch (ClassNotFoundException ex){
SelectorThread.logger().log(Level.WARNING,ex.getMessage(),ex);
} catch (InstantiationException ex){
SelectorThread.logger().log(Level.WARNING,ex.getMessage(),ex);
} catch (IllegalAccessException ex){
SelectorThread.logger().log(Level.WARNING,ex.getMessage(),ex);
}
return null;
|
public boolean | postExecute()Post-execute the ProcessorTask by preparing the response,
flushing the response and then close or keep-alive the connection.
processorTask.postResponse();
processorTask.postProcess();
processorTask.terminateProcess();
// De-reference so under stress we don't have a simili leak.
processorTask = null;
return false;
|
public boolean | preExecute()Pre-execute a ProcessorTask by parsing the request
line.
processorTask = asyncProcessorTask.getProcessorTask();
if ( processorTask == null ){
throw new IllegalStateException("Null ProcessorTask");
}
processorTask.preProcess();
processorTask.parseRequest();
return true;
|
public boolean | removeAsyncFilter(com.sun.enterprise.web.connector.grizzly.AsyncFilter asyncFilter)Remove an AsyncFilter
return asyncFilters.remove(asyncFilter);
|
public void | setAsyncHandler(com.sun.enterprise.web.connector.grizzly.AsyncHandler asyncHandler)Set the AsyncHandler who drive the asynchronous process.
this.asyncHandler = asyncHandler;
|
public void | setAsyncTask(com.sun.enterprise.web.connector.grizzly.AsyncTask asyncProcessorTask)Set the AsyncTask .
this.asyncProcessorTask = asyncProcessorTask;
|