Eclispe Job 用法

来源:互联网 发布:tq软件官方下载 编辑:程序博客网 时间:2024/06/05 03:50

Job 是一个可运行的工作单元,他可以提交(scheduled)给Job manager 运行。一旦job 被执行完成,这个执行完的job 还可以继续执行。
Job 有一个状态字段,用来显示job 的执行状态。一个job 开始于 NONE  状态。当一个job 被提交运行(a job is scheduled to be run),它为WAITING 状态。当一个job 开始运行时,它为RUNNING 状态。当执行完毕或被取消时,它的状态又回到NONE 状态。
当Job 为 WAITING 状态,用户调用Job.sleep() ,或者被延时提交( a job is scheduled to run after a specified delay) 时,一个Job 也可以为SLEEPING 状态。 仅有WAITING 的 Job 才能转变到SLEEPING。 Sleeping 的Job 可以被Job.wakeup() 方法唤醒,job 的状态由SLEEPING 变为WAITING。
Job 可以被设置优先级。这样可以根据优先级来使Job 执行。缺省的job 优先级为“长优先级”。

 

优先级 如下:(来自Eclipse Job 类文档)

static int BUILD
          Job priority constant (value 40) for build jobs.
static int DECORATE
          Job priority constant (value 50) for decoration jobs.
static int INTERACTIVE
          Job priority constant (value 10) for interactive jobs.
static int LONG
          Job priority constant (value 30) for long-running background jobs.
static int NONE
          Job state code (value 0) indicating that a job is not currently sleeping, waiting, or running (i.e., the job manager doesn't know anything about the job).
static int RUNNING
          Job state code (value 4) indicating that a job is currently running
static int SHORT
          Job priority constant (value 20) for short background jobs.

原创粉丝点击