Cytoscape 2.6.2 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.task
Interface Task

All Superinterfaces:
Haltable, Runnable
All Known Implementing Classes:
LayoutTask, LoadNetworkTask, PluginManagerInquireTask, SampleTask

public interface Task
extends Runnable, Haltable

Represents a task that can be terminated prematurely by the same entity that started the task - tasks are started with Task.run() and tasks are terminated prematurely [and asynchronously] with Task.halt().

Tasks, by definition, can only be run once per instance.

Because the same "parent program" that starts run() will determine whether or not halt() will be called at some point, there is no ambiguity in determining whether or not a process was terminated prematurely when run() returns.


Method Summary
 String getTitle()
          Gets a Human Readable Title of this Task.
 void halt()
          halt() is a non-blocking request to halt the task, and is called by an external entity.
 void run()
          run() executes the task, and is called by an external entity.
 void setTaskMonitor(TaskMonitor monitor)
          Lets this Task know who it should report to regarding task progress, errors, status description, etc.
 

Method Detail

run

void run()
run() executes the task, and is called by an external entity.

Task process computations should be executed in this method, by the same thread that calls this method.

run() shall only be called once for a given instance. If an asynchronous call to halt() is made while run() is executing, run() should make an effort to abort its operations and exit as soon as it is safe to do so.

Specified by:
run in interface Runnable

halt

void halt()
halt() is a non-blocking request to halt the task, and is called by an external entity.

halt() should not block; it should return quickly.

If [an asynchronous] thread is executing run() when halt() is called, a signal should be sent to the thread that is executing run() to abort and exit run().

halt() may return long before run() exits; run() will only return when it is safe to do so.

If run() has not been called at the time that halt() is invoked, a later call to run() should not actually "run" anything.

If run() has already been run and has exited by the time halt() is called, halt() should do nothing. There is no guarantee that halt() will be called on an instance of this class.

Specified by:
halt in interface Haltable

setTaskMonitor

void setTaskMonitor(TaskMonitor monitor)
                    throws IllegalThreadStateException
Lets this Task know who it should report to regarding task progress, errors, status description, etc. monitor may be null, in which case the task will stop reporting.

This method must be called exactly once, and before run() is invoked.

If this method is called more than once, the method may throw an IllegalStateException.

If this method is not called before run() then run() may throw an IllegalStateException.

TaskMonitor methods can only be be called from the thread that invokes run().

Parameters:
monitor - TaskMonitor Object.
Throws:
IllegalThreadStateException - Indicates that the TaskMonitor has already been set.

getTitle

String getTitle()
Gets a Human Readable Title of this Task.

Returns:
human readable title of task.

www.cytoscape.org