felix.society
Class Task

java.lang.Object
  extended by felix.society.Task
Direct Known Subclasses:
ExecuteOperatorTask, OptimizeDMOTask, TaskList, TaskSet

public abstract class Task
extends java.lang.Object

A concurrent task.

Author:
czhang

Nested Class Summary
static class Task.TaskType
          Type of task \in {TASKSET, TASKLIST, TASK}
 
Field Summary
 java.util.concurrent.Future currentFuture
          What future is currently running (used for join).
 Worker currentWorker
          What worker is currently running?
static java.util.concurrent.ExecutorService softpool
          A thread poll that only contains very very cheap threads (to support TaskSet > TaskList1, TaskList2 structure)
 
Constructor Summary
Task(Task.TaskType _type)
          The constructor.
Task(Task.TaskType _type, java.lang.Integer _nRuns)
           
 
Method Summary
 void addSubTask(Task _task)
           
 void execute(java.util.concurrent.ExecutorService pool)
          Execute this task.
abstract  Worker generateWorker()
          Generate worker for TASK (threads).
abstract  Worker generateWorker(java.util.concurrent.ExecutorService pool)
          Generate worker for TASKLIST, TASKSET (threads).
 Task.TaskType getType()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

softpool

public static java.util.concurrent.ExecutorService softpool
A thread poll that only contains very very cheap threads (to support TaskSet > TaskList1, TaskList2 structure)


currentWorker

public Worker currentWorker
What worker is currently running?


currentFuture

public java.util.concurrent.Future currentFuture
What future is currently running (used for join).

Constructor Detail

Task

public Task(Task.TaskType _type)
The constructor.

Parameters:
_type -

Task

public Task(Task.TaskType _type,
            java.lang.Integer _nRuns)
Method Detail

getType

public Task.TaskType getType()
Returns:

addSubTask

public void addSubTask(Task _task)

execute

public void execute(java.util.concurrent.ExecutorService pool)
             throws java.lang.Exception
Execute this task.

Parameters:
pool - The thread pool
Throws:
java.lang.Exception

generateWorker

public abstract Worker generateWorker()
Generate worker for TASK (threads).

Returns:

generateWorker

public abstract Worker generateWorker(java.util.concurrent.ExecutorService pool)
Generate worker for TASKLIST, TASKSET (threads).

Parameters:
pool - The thread pool in which subtasks will run.
Returns: