Methods Summary |
---|
public void | addAsyncFilter(com.sun.enterprise.web.connector.grizzly.AsyncFilter asyncFilter)Add an AsyncFilter
asyncFilters.add(asyncFilter);
|
public void | addToInterruptedQueue(com.sun.enterprise.web.connector.grizzly.AsyncTask task)Add a Task to the interrupted queue.
interrruptedQueue.offer(task);
|
public java.lang.String | getAsyncExecutorClassName()Get the code>AsyncExecutor used by this object.
return asyncExecutorClassName;
|
private com.sun.enterprise.web.connector.grizzly.AsyncTask | getAsyncProcessorTask()Return an instance of AsyncTask , which is
configured and ready to be executed.
AsyncTask asyncTask = asyncProcessors.poll();
if ( asyncTask == null) {
asyncTask = newAsyncProcessorTask();
} else {
asyncTask.recycle();
}
return asyncTask;
|
public void | handle(com.sun.enterprise.web.connector.grizzly.Task task)Handle an instance of a Task . This method is invoked
first by a ProcessorTask , which delegate its execution to
this handler. Second, this method is invoked once a
ProcessorTask needs to be removed from the interrupted queue.
AsyncTask apt = null;
if (task.getType() == Task.PROCESSOR_TASK) {
apt = getAsyncProcessorTask();
apt.setProcessorTask((ProcessorTask)task);
apt.setSelectorThread(task.getSelectorThread());
}
boolean wasInterrupted = interrruptedQueue.remove(task);
if ( !wasInterrupted && apt == null) {
String errorMsg = "";
if ( task.getSelectionKey() != null ) {
errorMsg = "Connection " + task.getSelectionKey().channel()
+ " wasn't interrupted";
}
throw new IllegalStateException(errorMsg);
} else if ( apt == null ){
apt = (AsyncTask)task;
}
apt.execute();
|
private com.sun.enterprise.web.connector.grizzly.AsyncExecutor | newAsyncExecutor(com.sun.enterprise.web.connector.grizzly.AsyncTask asyncTask)Create an instance of DefaultAsyncExecutor
Class className = null;
AsyncExecutor asyncExecutor = null;
try{
className = Class.forName(asyncExecutorClassName);
asyncExecutor = (AsyncExecutor)className.newInstance();
} catch (ClassNotFoundException ex){
throw new RuntimeException(ex);
} catch (InstantiationException ex){
throw new RuntimeException(ex);
} catch (IllegalAccessException ex){
throw new RuntimeException(ex);
}
if ( asyncExecutor != null ){
asyncExecutor.setAsyncTask(asyncTask);
asyncExecutor.setAsyncHandler(this);
for (AsyncFilter l : asyncFilters){
asyncExecutor.addAsyncFilter(l);
}
}
return asyncExecutor;
|
private com.sun.enterprise.web.connector.grizzly.AsyncTask | newAsyncProcessorTask()Create an instance of AsyncTask
AsyncTask asyncTask = new AsyncProcessorTask();
asyncTask.setAsyncExecutor(newAsyncExecutor(asyncTask));
return asyncTask;
|
public boolean | removeAsyncFilter(com.sun.enterprise.web.connector.grizzly.AsyncFilter asyncFilter)Remove an AsyncFilter
return asyncFilters.remove(asyncFilter);
|
public void | removeFromInterruptedQueue(com.sun.enterprise.web.connector.grizzly.AsyncTask task)Remove the Task from the interrupted queue.
interrruptedQueue.remove(task);
|
public void | returnTask(com.sun.enterprise.web.connector.grizzly.AsyncTask asyncTask)Return th Task to the pool
asyncProcessors.offer(asyncTask);
|
public void | setAsyncExecutorClassName(java.lang.String asyncExecutorClassName)Set the AsyncExecutor used by this object.
this.asyncExecutorClassName = asyncExecutorClassName;
|