public class TaskEngine extends Object
Title: 常用代码打包
Description: A class to manage the execution of tasks in the Jive system. A TaskEngine object accepts Runnable objects and queues them for execution by worker threads. Optionally, a priority may be assigned to each task. Tasks with a higher priority are taken from the queue first.
Copyright: Copyright (c) 2006
Company: www.justdos.net
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
HIGH_PRIORITY |
static int |
LOW_PRIORITY |
static int |
MEDIUM_PRIORITY |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
addTask(int priority,
Runnable task)
Adds a task to the task queue.
|
static void |
addTask(Runnable task)
Adds a task to the task queue.
|
static TimerTask |
scheduleTask(int priority,
Runnable task,
Date date)
Schedules a task to be run once after a specified delay.
|
static TimerTask |
scheduleTask(int priority,
Runnable task,
long delay,
long period)
Schedules a task to periodically run.
|
static TimerTask |
scheduleTask(Runnable task,
Date date)
Schedules a task to be run once after a specified delay.
|
static TimerTask |
scheduleTask(Runnable task,
long delay,
long period)
Schedules a task to periodically run.
|
public static final int HIGH_PRIORITY
public static final int MEDIUM_PRIORITY
public static final int LOW_PRIORITY
public static void addTask(Runnable task)
task - the task to executepublic static void addTask(int priority,
Runnable task)
priority - the priority of the task in the queue.task - the task to executepublic static TimerTask scheduleTask(Runnable task, Date date)
task - task to be scheduled.date - the date in milliseconds at which the task is to be executed.public static TimerTask scheduleTask(int priority, Runnable task, Date date)
priority - the priority of the task in the queue.task - task to be scheduled.date - the date in milliseconds at which the task is to be executed.public static TimerTask scheduleTask(Runnable task, long delay, long period)
task - task to be scheduled.delay - delay in milliseconds before task is to be executed.period - time in milliseconds between successive task executions.public static TimerTask scheduleTask(int priority, Runnable task, long delay, long period)
priority - the priority of the task in the queue.task - task to be scheduled.delay - delay in milliseconds before task is to be executed.period - time in milliseconds between successive task executions.Copyright © 2023 onecode. All rights reserved.