com.sun.enterprise.web.ara
Class TaskWrapper

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

public abstract class TaskWrapper
extends Object
implements Task

Wrap an instance of a Task

Author:
Jeanfrancois Arcand

Field Summary
protected  Task wrappedTask
          The wrapped Task instance.
 
Fields inherited from interface com.sun.enterprise.web.connector.grizzly.Task
ACCEPT_TASK, PROCESSOR_TASK, READ_TASK
 
Constructor Summary
TaskWrapper()
           
 
Method Summary
 void addTaskListener(TaskListener task)
          Add a Task to this class.
 Object call()
           
 void cancelTask(String message, String httpCode)
          Cancel the task.
 void clearTaskListeners()
          Remove all listeners
abstract  void doTask()
          Execute the Task
abstract  void execute()
          Execute the Task< using this thread or a Pipeline.
 KeepAliveStats getKeepAliveStats()
          Gets the KeepAliveStats associated with this task.
 boolean getRecycle()
          Return true if this Task will be recycled.
 RequestGroupInfo getRequestGroupInfo()
          Gets the RequestGroupInfo from this task.
 SelectionKey getSelectionKey()
          Return the SelectionKey associated with this tasks.
 SelectorThread getSelectorThread()
          Returns the SelectorThread used by this task.
 ArrayList getTaskListeners()
          Return the ArrauList containing the listeners.
 int getType()
          Return this Tash type.
 Task getWrappedTask()
          Return the wrapped Task
 boolean isMonitoringEnabled()
          Returns true if monitoring has been enabled, false otherwise.
 void recycle()
          Recycle this task.
 void removeTaskListener(TaskListener task)
          Remove a Task to this class.
abstract  void run()
          Execute the Task< using this thread or a Pipeline.
 void setRecycle(boolean recycle)
          Recycle the Task after every doTask invokation.
 void setSelectionKey(SelectionKey key)
          Set the SelectionKey
 void setSelectorThread(SelectorThread selectorThread)
          Set the SelectorThread used by this task.
abstract  Task wrap(Task task)
          Wrap an instance of a Task
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.enterprise.web.connector.grizzly.Task
getPipeline, setPipeline
 

Field Detail

wrappedTask

protected Task wrappedTask
The wrapped Task instance.

Constructor Detail

TaskWrapper

public TaskWrapper()
Method Detail

doTask

public abstract void doTask()
                     throws IOException
Execute the Task

Specified by:
doTask in interface Task
Throws:
IOException

wrap

public abstract Task wrap(Task task)
Wrap an instance of a Task


execute

public abstract void execute()
Execute the Task< using this thread or a Pipeline.

Specified by:
execute in interface Task

run

public abstract void run()
Execute the Task< using this thread or a Pipeline.

Specified by:
run in interface Runnable

getWrappedTask

public Task getWrappedTask()
Return the wrapped Task


addTaskListener

public void addTaskListener(TaskListener task)
Description copied from interface: Task
Add a Task to this class.

Specified by:
addTaskListener in interface Task

call

public Object call()
            throws Exception
Specified by:
call in interface Callable
Throws:
Exception

cancelTask

public void cancelTask(String message,
                       String httpCode)
Description copied from interface: Task
Cancel the task.

Specified by:
cancelTask in interface Task

clearTaskListeners

public void clearTaskListeners()
Description copied from interface: Task
Remove all listeners

Specified by:
clearTaskListeners in interface Task

getKeepAliveStats

public KeepAliveStats getKeepAliveStats()
Description copied from interface: Task
Gets the KeepAliveStats associated with this task.

Specified by:
getKeepAliveStats in interface Task

getRecycle

public boolean getRecycle()
Description copied from interface: Task
Return true if this Task will be recycled.

Specified by:
getRecycle in interface Task

getRequestGroupInfo

public RequestGroupInfo getRequestGroupInfo()
Description copied from interface: Task
Gets the RequestGroupInfo from this task.

Specified by:
getRequestGroupInfo in interface Task

getSelectionKey

public SelectionKey getSelectionKey()
Description copied from interface: Task
Return the SelectionKey associated with this tasks.

Specified by:
getSelectionKey in interface Task

getSelectorThread

public SelectorThread getSelectorThread()
Description copied from interface: Task
Returns the SelectorThread used by this task.

Specified by:
getSelectorThread in interface Task

getTaskListeners

public ArrayList getTaskListeners()
Description copied from interface: Task
Return the ArrauList containing the listeners.

Specified by:
getTaskListeners in interface Task

getType

public int getType()
Description copied from interface: Task
Return this Tash type.

Specified by:
getType in interface Task

isMonitoringEnabled

public boolean isMonitoringEnabled()
Description copied from interface: Task
Returns true if monitoring has been enabled, false otherwise.

Specified by:
isMonitoringEnabled in interface Task

recycle

public void recycle()
Description copied from interface: Task
Recycle this task.

Specified by:
recycle in interface Task

removeTaskListener

public void removeTaskListener(TaskListener task)
Description copied from interface: Task
Remove a Task to this class.

Specified by:
removeTaskListener in interface Task

setRecycle

public void setRecycle(boolean recycle)
Description copied from interface: Task
Recycle the Task after every doTask invokation.

Specified by:
setRecycle in interface Task

setSelectionKey

public void setSelectionKey(SelectionKey key)
Description copied from interface: Task
Set the SelectionKey

Specified by:
setSelectionKey in interface Task

setSelectorThread

public void setSelectorThread(SelectorThread selectorThread)
Description copied from interface: Task
Set the SelectorThread used by this task.

Specified by:
setSelectorThread in interface Task


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