Packages
 In this topic

*Methods

 

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

 


Class Task

public class Task
{
  // Methods
  public static boolean cancel(int id);
  public static int schedule(Runnable runnable);
  public static int schedule(Runnable runnable, long when);
  public static int schedule(Runnable runnable, long when,
        boolean lightweight);
}

This class schedules and manages the execution of runnable objects in the global task manager.

Methods

cancel

public static 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.

schedule

public static int schedule(Runnable runnable);

Schedules a runnable object to run immediately in the global task manager as a lightweight task.

Return Value:

Returns a non-zero integer that identifies the task.

ParameterDescription
runnable The object scheduled to run.

schedule

public static int schedule(Runnable runnable, long when);

Schedules a runnable object to run in the global task manager at the specified time as a lightweight task.

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.

schedule

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

Schedules a runnable object to run in the global task manager at the specified time and optionally as a lightweight task or not.

Return Value:

Returns a non-zero integer that identifies the task.

ParameterDescription
runnable The object that runs.
when The time at which the object runs.
lightweight Set to true to run the task as a lightweight task; false, otherwise.

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