|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.grizzly.http.TaskBase
public abstract class TaskBase
Abstract implementation of a Task
object.
Field Summary | |
---|---|
protected SelectionKey |
key
The SelectionKey used by this task. |
protected ArrayList<TaskListener> |
listeners
List of listeners |
protected Pipeline |
pipeline
The Pipeline object associated with this
Task |
protected boolean |
recycle
Recycle this task |
protected SelectorThread |
selectorThread
The SelectorThread who created this task. |
protected int |
type
This number represent a specific implementation of a Task
instance. |
Fields inherited from interface com.sun.grizzly.http.Task |
---|
ACCEPT_TASK, PROCESSOR_TASK, READ_TASK |
Constructor Summary | |
---|---|
TaskBase()
|
Method Summary | |
---|---|
void |
addTaskListener(TaskListener task)
Add the given TaskListener to this Task . |
Object |
call()
By default, do nothing when a Callable is invoked. |
void |
cancelTask(String message,
String code)
Cancel the task. |
void |
clearTaskListeners()
Clean all the listeners of this Task |
void |
execute()
Execute the task based on its Pipeline . |
protected void |
fireTaskEvent(TaskEvent<?> event)
Notify listeners. |
KeepAliveStats |
getKeepAliveStats()
Gets the KeepAliveStats associated with this task. |
Pipeline |
getPipeline()
Return the pipeline used by this object. |
boolean |
getRecycle()
Return true if this Task is recyclable. |
RequestGroupInfo |
getRequestGroupInfo()
Gets the RequestGroupInfo from this task. |
SelectionKey |
getSelectionKey()
Return the SelectionKey associated with this task. |
SelectorThread |
getSelectorThread()
Return the SelectorThread |
Socket |
getSocket()
Return the current Socket used by this instance |
ArrayList |
getTaskListeners()
Return all listeners of this Task . |
int |
getType()
Return this Tash type. |
boolean |
isMonitoringEnabled()
Returns true if monitoring has been enabled, false
otherwise. |
void |
recycle()
Recycle internal state. |
void |
removeTaskListener(TaskListener task)
Remove the given TaskListener/code> from this
|
void |
run()
Some Pipeline implementation requires a instance of
Runnable instance. |
void |
setPipeline(Pipeline pipeline)
Set the pipeline on which Worker Threads will synchronize. |
void |
setRecycle(boolean recycle)
Declare whether this Task is recyclable. |
void |
setSelectionKey(SelectionKey key)
Set the SelectionKey |
void |
setSelectorThread(SelectorThread selectorThread)
Set the SelectorThread object. |
void |
taskEvent(TaskEvent event)
Base implementation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sun.grizzly.http.Task |
---|
doTask |
Field Detail |
---|
protected int type
Task
instance.
protected ArrayList<TaskListener> listeners
protected Pipeline pipeline
Pipeline
object associated with this
Task
protected SelectionKey key
SelectionKey
used by this task.
protected boolean recycle
protected SelectorThread selectorThread
SelectorThread
who created this task.
Constructor Detail |
---|
public TaskBase()
Method Detail |
---|
public int getType()
Task
Tash
type.
getType
in interface Task
public void setSelectorThread(SelectorThread selectorThread)
SelectorThread
object.
setSelectorThread
in interface Task
public SelectorThread getSelectorThread()
SelectorThread
getSelectorThread
in interface Task
public void setPipeline(Pipeline pipeline)
setPipeline
in interface Task
public Pipeline getPipeline()
getPipeline
in interface Task
public void setSelectionKey(SelectionKey key)
SelectionKey
setSelectionKey
in interface Task
public SelectionKey getSelectionKey()
SelectionKey
associated with this task.
getSelectionKey
in interface Task
public RequestGroupInfo getRequestGroupInfo()
RequestGroupInfo
from this task.
getRequestGroupInfo
in interface Task
public boolean isMonitoringEnabled()
true
if monitoring has been enabled, false
otherwise.
isMonitoringEnabled
in interface Task
public KeepAliveStats getKeepAliveStats()
KeepAliveStats
associated with this task.
getKeepAliveStats
in interface Task
public void execute()
Pipeline
. If the
Pipeline
is null, then execute the task on using the
calling thread.
execute
in interface Task
public void addTaskListener(TaskListener task)
TaskListener
to this Task
.
addTaskListener
in interface Task
public void removeTaskListener(TaskListener task)
TaskListener/code> from this
Task
.
- Specified by:
removeTaskListener
in interface Task
public void clearTaskListeners()
Task
clearTaskListeners
in interface Task
protected void fireTaskEvent(TaskEvent<?> event)
public void recycle()
recycle
in interface Task
public ArrayList getTaskListeners()
Task
.
getTaskListeners
in interface Task
TaskListener
instances registered with this Task
public void run()
Pipeline
implementation requires a instance of
Runnable
instance.
run
in interface Runnable
public void setRecycle(boolean recycle)
Task
is recyclable. If so, this
Task
will be recycled after every invocation of
doTask()
.
setRecycle
in interface Task
public boolean getRecycle()
true
if this Task
is recyclable.
getRecycle
in interface Task
public Socket getSocket()
Socket
used by this instance
Socket
used by this instancepublic void cancelTask(String message, String code)
cancelTask
in interface Task
message
- the HTTP message to included within the html pagecode
- The http code to use. If null, automatically close the
connection without sending an error page.public Object call() throws Exception
Callable
is invoked.
call
in interface Callable
Exception
public void taskEvent(TaskEvent event)
taskEvent
in interface TaskListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |