Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.util   Previous This
Package
Next

 


Class TaskManager

public class TaskManager implements Runnable
{
  // Constructors
  public TaskManager(ThreadGroup threadGroup);
  public TaskManager(ThreadGroup threadGroup,
        boolean runTasksAsDaemons);

  // Methods
  public synchronized boolean cancel(int id);
  public static TaskManager global();
  public void run();
  public int schedule(Runnable runnable);
  public int schedule(Runnable runnable, long when);
  public synchronized int schedule(Runnable runnable, long when,
        boolean lightweight);
}

This class schedules or manages the execution of runnable objects.

Constructors

TaskManager

public TaskManager(ThreadGroup threadGroup);

Constructs a new TaskManager object.

ParameterDescription
threadGroup The thread group that the task manager creates threads in.

TaskManager

public TaskManager(ThreadGroup threadGroup, boolean runTasksAsDaemons);

Constructs a new TaskManager object.

ParameterDescription
threadGroup The thread group that the task manager creates threads in.
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 true if the runnable object was cancelled successfully; returns false if the task was already run or had never been scheduled.

ParameterDescription
id An integer that identifies the task.

global

public static TaskManager global();

Retrieves the global task manager.

Return Value:

Returns the global TaskManager object.

run

public void run();

Called when the thread is started.

Return Value:

No return value.

schedule

public int schedule(Runnable runnable);

Schedules a runnable object to run immediately.

Return Value:

Returns a non-zero integer that identifies the task.

ParameterDescription
runnable The object that is run.

schedule

public int schedule(Runnable runnable, long when);

Schedules a runnable object to run at a specified time.

Return Value:

Returns a non-zero integer that identifies the task.

ParameterDescription
runnable The object that is run.
long The time at which the object is to start.

schedule

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

Schedules a runnable object to run at a specified time.

Return Value:

Returns a non-zero integer that identifies the task.

ParameterDescription
runnable The object that is run.
when The time at which the object is run.
lightweight Set to true to run the task as a lightweight task.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.