Package com.ms.util Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class TaskManager

Constructors , Methods

public class TaskManager extends ThreadGroup implements Runnable {
  // Constructors
  public TaskManager()
  public TaskManager(boolean runTasksAsDaemons)
  public TaskManager(String name)
  public TaskManager(String name, boolean runTasksAsDaemons)
  public TaskManager(ThreadGroup parent)
  public TaskManager(ThreadGroup parent, boolean runTasksAsDaemons)
  public TaskManager(ThreadGroup parent, String name)
  public TaskManager(ThreadGroup parent, String name, boolean runTasksAsDaemons)
  // Methods
  public static TaskManager global()
  public int schedule(Runnable runnable)
  public int schedule(Runnable runnable, long when)
  public synchronized int schedule(Runnable runnable, long when, boolean lightweight)
  public synchronized boolean cancel(int id)
  public void run()
}

This class is for scheduling or managing the execution of runnable objects.


Constructors


TaskManager

public TaskManager()

Constructs a new TaskManager in the current thread's thread group.


TaskManager

public TaskManager(boolean runTasksAsDaemons)

Constructs a new TaskManager in the current thread's thread group.

ParameterDescription
runTasksAsDaemons Indicates whether the tasks in this task manager are run on daemon threads.


TaskManager

public TaskManager(String name)

Constructs a new TaskManager in the current thread's thread group.

ParameterDescription
name The name of the task manager.


TaskManager

public TaskManager(String name, boolean runTasksAsDaemons)

Constructs a new TaskManager in the current thread's thread group.

ParameterDescription
name The name of the task manager.
runTasksAsDaemons Set to true if the tasks in this task manager are to run on daemon threads; otherwise set to false.


TaskManager

public TaskManager(ThreadGroup parent)

Constructs a new TaskManager.

ParameterDescription
parent The parent thread group for this task manager.


TaskManager

public TaskManager(ThreadGroup parent, boolean runTasksAsDaemons)

Constructs a new TaskManager.

ParameterDescription
parent The parent thread group for this task manager.
runTasksAsDaemons Set to true if the tasks in this task manager are to run on daemon threads; otherwise set to false.


TaskManager

public TaskManager(ThreadGroup parent, String name)

Constructs a new TaskManager

ParameterDescription
parent The parent thread group for this task manager.
name The name of the task manager.


TaskManager

public TaskManager(ThreadGroup parent, String name, boolean runTasksAsDaemons)

Constructs a new TaskManager

ParameterDescription
parent The parent thread group for this task manager
name the name of the task manager
runTasksAsDaemons Set to true if the tasks in this task manager are to run on daemon threads; otherwise set to false.


Methods


cancel

public synchronized boolean cancel(int id)

Cancels a pending runnable object.

Return Value:

Returns a boolean indicating whether the runnable was successfully cancelled. This value is false if the task was already run or had never been scheduled; otherwise it is true.

ParameterDescription
id An integer identifying the task.


global

public static TaskManager global()

Returns the global task manager.

Return Value:

Returns the global task manager object.


run

public void run()


schedule

public int schedule(Runnable runnable)

Schedules a runnable object to be run immediately.

Return Value:

Returns a non-zero integer identifying the task.

ParameterDescription
runnable The object to run.


schedule

public int schedule(Runnable runnable, long when)

Schedules a runnable object to be run at the specified time.

Return Value:

Returns a non-zero integer identifying the task.

ParameterDescription
runnable The object to run.


schedule

public synchronized int schedule(Runnable runnable, long when, boolean lightweight)

Schedules a runnable object to be run at the specified time.

Return Value:

Returns a non-zero integer identifying the task.

ParameterDescription
runnable The object to run.
when The time to run the object.
lightweight Whether to run the task as a lightweight task.



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.