com.sun.enterprise.web.ara
Class IsolatedTask

java.lang.Object
  extended by com.sun.enterprise.web.ara.TaskWrapper
      extended by com.sun.enterprise.web.ara.IsolatedTask
All Implemented Interfaces:
Task, TaskListener, Runnable, Callable

public class IsolatedTask
extends TaskWrapper
implements TaskListener

This task is used to configure an instance of .ReadTask based on the Rule implementation.

Author:
Jeanfrancois Arcand

Field Summary
protected  StreamAlgorithm algorithm
          The algorithm used to determine the context-root, the HTTP method, the protocol etc.
protected  int initialByteLimit
          The ByteBuffer initial limit before applying the Algorithm
protected  int initialBytePosition
          The ByteBuffer initial position before applying the Algorithm
static int ISOLATED_TASK
           
protected  ArrayList<TaskListener> listeners
          List of listeners
protected  Pipeline pipeline
          The Thread Pool wrapper.
protected  RulesExecutor rulesExecutor
          The RuleExecutor used to apply Rule
protected  TaskEvent<IsolatedTask> taskEvent
          The TaskEvent used between this task and it's attached ReadTask
 
Fields inherited from class com.sun.enterprise.web.ara.TaskWrapper
wrappedTask
 
Fields inherited from interface com.sun.enterprise.web.connector.grizzly.Task
ACCEPT_TASK, PROCESSOR_TASK, READ_TASK
 
Constructor Summary
IsolatedTask()
           
 
Method Summary
 void addTaskListener(TaskListener task)
          Add the given TaskListener to this Task.
 void clearTaskListeners()
          Clean all the listeners of this Task
 void doTask()
          Apply a set of Rules to the current bytes requests using an instance of ReadTask byte buffer.
 void execute()
          Execute that task using the current Thread.
protected  void fireTaskEvent(TaskEvent<?> event)
          Notify listeners of that class that the processing has completed.
 Pipeline getPipeline()
          Get the Thread pool wrapper.
 int getType()
          This task type.
 void removeTaskListener(TaskListener task)
          Remove the given TaskListener/code> from this Task.
 void run()
          Execute the logic required to isolate the task.
 void setAlgorithm(StreamAlgorithm algorithm)
          Set the Algorithm used by this task.
 void setPipeline(Pipeline pipeline)
          Set the Thread pool wrapper.
 void setRulesExecutor(RulesExecutor rulesExecutor)
          Set the RuleExecutor instance used by this task.
 void taskEvent(TaskEvent event)
          Remove the SelectionKey from the cache.
 IsolatedTask wrap(Task task)
          Wrao the Task with this task.
 
Methods inherited from class com.sun.enterprise.web.ara.TaskWrapper
call, cancelTask, getKeepAliveStats, getRecycle, getRequestGroupInfo, getSelectionKey, getSelectorThread, getTaskListeners, getWrappedTask, isMonitoringEnabled, recycle, setRecycle, setSelectionKey, setSelectorThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISOLATED_TASK

public static final int ISOLATED_TASK
See Also:
Constant Field Values

algorithm

protected StreamAlgorithm algorithm
The algorithm used to determine the context-root, the HTTP method, the protocol etc.


rulesExecutor

protected RulesExecutor rulesExecutor
The RuleExecutor used to apply Rule


listeners

protected ArrayList<TaskListener> listeners
List of listeners


initialBytePosition

protected int initialBytePosition
The ByteBuffer initial position before applying the Algorithm


initialByteLimit

protected int initialByteLimit
The ByteBuffer initial limit before applying the Algorithm


taskEvent

protected TaskEvent<IsolatedTask> taskEvent
The TaskEvent used between this task and it's attached ReadTask


pipeline

protected Pipeline pipeline
The Thread Pool wrapper.

Constructor Detail

IsolatedTask

public IsolatedTask()
Method Detail

doTask

public void doTask()
            throws IOException
Apply a set of Rules to the current bytes requests using an instance of ReadTask byte buffer. Once the Rule has been successfully applied, execute it.

Specified by:
doTask in interface Task
Specified by:
doTask in class TaskWrapper
Throws:
IOException

setRulesExecutor

public void setRulesExecutor(RulesExecutor rulesExecutor)
Set the RuleExecutor instance used by this task.


setAlgorithm

public void setAlgorithm(StreamAlgorithm algorithm)
Set the Algorithm used by this task.


wrap

public IsolatedTask wrap(Task task)
Wrao the Task with this task.

Specified by:
wrap in class TaskWrapper

execute

public void execute()
Execute that task using the current Thread.

Specified by:
execute in interface Task
Specified by:
execute in class TaskWrapper

run

public void run()
Execute the logic required to isolate the task.

Specified by:
run in interface Runnable
Specified by:
run in class TaskWrapper

addTaskListener

public void addTaskListener(TaskListener task)
Add the given TaskListener to this Task.

Specified by:
addTaskListener in interface Task
Overrides:
addTaskListener in class TaskWrapper

removeTaskListener

public void removeTaskListener(TaskListener task)
Remove the given TaskListener/code> from this Task.

Specified by:
removeTaskListener in interface Task
Overrides:
removeTaskListener in class TaskWrapper

clearTaskListeners

public void clearTaskListeners()
Clean all the listeners of this Task

Specified by:
clearTaskListeners in interface Task
Overrides:
clearTaskListeners in class TaskWrapper

fireTaskEvent

protected void fireTaskEvent(TaskEvent<?> event)
Notify listeners of that class that the processing has completed.


taskEvent

public void taskEvent(TaskEvent event)
Remove the SelectionKey from the cache.

Specified by:
taskEvent in interface TaskListener

getType

public int getType()
This task type.

Specified by:
getType in interface Task
Overrides:
getType in class TaskWrapper

setPipeline

public void setPipeline(Pipeline pipeline)
Set the Thread pool wrapper.

Specified by:
setPipeline in interface Task

getPipeline

public Pipeline getPipeline()
Get the Thread pool wrapper.

Specified by:
getPipeline in interface Task


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.