Methods Summary |
---|
public void | addTask(com.sun.enterprise.web.connector.grizzly.Task task)Execute the wrapped Task
// SSL not yet supported.
if (task.getType() == Task.READ_TASK){
super.addTask(wrap(task));
} else {
super.addTask(task);
}
|
public void | initPipeline()Initialize this pipeline by first initializing its parent, and then by
creating the caches and the rule executor engine.
// 1. first, init this pipeline.
super.initPipeline();
// 2. Create cache
isolatedTasks = new ConcurrentLinkedQueue<IsolatedTask>();
// 3. Cache IsolatedTask
for (int i=0; i < maxThreads; i++){
isolatedTasks.offer(newIsolatedTask());
}
|
private java.lang.Object | loadInstance(java.lang.String property)Instanciate a class based on a property.
Class className = null;
Pipeline pipeline = null;
try{
className = Class.forName(property);
return className.newInstance();
} catch (ClassNotFoundException ex){
} catch (InstantiationException ex){
} catch (IllegalAccessException ex){
}
// Default
if ( property.equals(ALGORITHM_CLASS)){
return new ContextRootAlgorithm();
} else if ( property.equals(RULE_EXECUTOR_CLASS)){
return new IsolationRulesExecutor();
}
throw new IllegalStateException();
|
private com.sun.enterprise.web.connector.grizzly.StreamAlgorithm | newAlgorithm()Create a new StreamAlgorithm .
return (StreamAlgorithm)loadInstance(ALGORITHM_CLASS);
|
private IsolatedTask | newIsolatedTask()Create a new IsolatedTask
IsolatedTask task = new IsolatedTask();
task.setAlgorithm(newAlgorithm());
task.setRulesExecutor(newRulesExecutor());
task.addTaskListener(this);
task.pipeline = this;
return task;
|
private RulesExecutor | newRulesExecutor()Create the new RulesExecutor
return (IsolationRulesExecutor)loadInstance(RULE_EXECUTOR_CLASS);
|
public void | taskEvent(com.sun.enterprise.web.connector.grizzly.TaskEvent event)Return the IsolatedTask to the pool.
if ( event.getStatus() == TaskEvent.COMPLETED)
isolatedTasks.offer((IsolatedTask)event.attachement());
|
public void | taskStarted(com.sun.enterprise.web.connector.grizzly.TaskEvent event)
; // Do nothing.
|
private com.sun.enterprise.web.connector.grizzly.Task | wrap(com.sun.enterprise.web.connector.grizzly.Task task)Wrap the current Task using an IsolatedTask
IsolatedTask isolatedTask = isolatedTasks.poll();
if ( isolatedTask == null){
isolatedTask = newIsolatedTask();
}
isolatedTask.wrap(task);
return isolatedTask;
|