com.togethersoft.sca.core
Class JobControl

java.lang.Object
  |
  +--com.togethersoft.sca.core.JobControl

public abstract class JobControl
extends java.lang.Object

Allows to run long tasks in a controlled manner.

A job control object is associated with a running task. The task should periodically check the state of the associated job control object. When the job control object signals that a cancel request was placed, the task should interrupt itself.

IJobControl also conveys information about the progress of the running task. Its method complete may be overridden by clients to receive notifications.

Job control objects cannot be reused. For each started task, a new job control object must be created.


Constructor Summary
JobControl()
           
 
Method Summary
 void cancel()
          Places a request to cancel the task.
abstract  void complete(int completed)
          This method is called by the running task to indicate which part of work has been completed.
 boolean isCanceled()
          Indicates whether the task was canceled.
 void setScale(double scale)
          Internal method.
abstract  void start(java.lang.String task)
          This method is called by the running task to indicated that s subtask is about to begin.
 void update(double delta)
          Internal method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobControl

public JobControl()
Method Detail

cancel

public final void cancel()
Places a request to cancel the task.

complete

public abstract void complete(int completed)
This method is called by the running task to indicate which part of work has been completed.
Parameters:
completed - percentage of completed work.

isCanceled

public final boolean isCanceled()
Indicates whether the task was canceled.
Returns:
true if the task was canceled.

setScale

public final void setScale(double scale)
Internal method. Should not be called by clients.

start

public abstract void start(java.lang.String task)
This method is called by the running task to indicated that s subtask is about to begin.
Parameters:
task - the name of the starting subtask.

update

public final void update(double delta)
Internal method. Should not be called by clients.