org.glassfish.grizzly.web
Class TaskBase

java.lang.Object
  extended by org.glassfish.grizzly.web.TaskBase
All Implemented Interfaces:
Runnable, Callable, Task
Direct Known Subclasses:
AsyncProcessorTask, ProcessorTask

public abstract class TaskBase
extends Object
implements Task

Abstract implementation of a Task object.

Author:
Jean-Francois Arcand

Field Summary
protected  Connection connection
          The Connection used by this task.
protected  ExecutorService threadPool
          The ExecutorService object associated with this Task
protected  WebFilter webFilter
          The WebFilter.
 
Constructor Summary
TaskBase()
           
 
Method Summary
 Object call()
          By default, do nothing when a Callable is invoked.
 void execute()
          Execute the task based on its ExecutorService.
 Connection getConnection()
           
 TaskListener getTaskListener()
          The TaskListener associated with this instance.
 ExecutorService getThreadPool()
          Return the thread pool used by this object.
 WebFilter getWebFilter()
           
 void recycle()
          Recycle internal state.
 void run()
          Some ExecutorService implementation requires a instance of Runnable instance.
 void setConnection(Connection connection)
           
 void setTaskListener(TaskListener taskListener)
          Set the TaskListener associated with this class.
 void setThreadPool(ExecutorService threadPool)
          Set the thread pool on which Worker Threads will synchronize.
 void setWebFilter(WebFilter webFilter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.glassfish.grizzly.web.Task
doTask
 

Field Detail

threadPool

protected ExecutorService threadPool
The ExecutorService object associated with this Task


connection

protected Connection connection
The Connection used by this task.


webFilter

protected WebFilter webFilter
The WebFilter.

Constructor Detail

TaskBase

public TaskBase()
Method Detail

getWebFilter

public WebFilter getWebFilter()

setWebFilter

public void setWebFilter(WebFilter webFilter)

setThreadPool

public void setThreadPool(ExecutorService threadPool)
Set the thread pool on which Worker Threads will synchronize.

Specified by:
setThreadPool in interface Task

getThreadPool

public ExecutorService getThreadPool()
Return the thread pool used by this object.

Specified by:
getThreadPool in interface Task

getConnection

public Connection getConnection()
Specified by:
getConnection in interface Task

setConnection

public void setConnection(Connection connection)
Specified by:
setConnection in interface Task

execute

public void execute()
Execute the task based on its ExecutorService. If the ExecutorService is null, then execute the task on using the calling thread.

Specified by:
execute in interface Task

recycle

public void recycle()
Recycle internal state.

Specified by:
recycle in interface Task

run

public void run()
Some ExecutorService implementation requires a instance of Runnable instance.

Specified by:
run in interface Runnable

call

public Object call()
            throws Exception
By default, do nothing when a Callable is invoked.

Specified by:
call in interface Callable
Throws:
Exception

getTaskListener

public TaskListener getTaskListener()
The TaskListener associated with this instance.

Returns:
TaskListener associated with this instance.

setTaskListener

public void setTaskListener(TaskListener taskListener)
Set the TaskListener associated with this class.

Parameters:
{@link - TaskListener} associated with this instance.


Copyright © 2009 SUN Microsystems. All Rights Reserved.