你代码中的sleep()跟this.sleep()作用是一样的,可能调用的是主线程的sleep()方法,改成这样试试:
Job job = new Job("Job Name"){ 
        protected IStatus run(IProgressMonitor monitor) { 
        System.out.println("------>Job.1"); 
        Thread.sleep(); 
        System.out.println("--------->Job.2"); 
        return Status.OK_STATUS; 
        } 
}; 
job.schedule(2000); 

解决方案 »

  1.   

    而且sleep应该可以设置sleep多少时间:
     Thread.sleep(2000); 
      

  2.   

    主要问题是我不能预设时间。我需要在其它的地方使用wakeup的方式唤醒该Job。
      

  3.   

    那你不应该用sleep,应该用wait()和notify()方法。
      

  4.   

    根据API Doc
    If this job is not currently waiting to be run, this method has no effect. 
    你在调用sleep()的时候线程已经在运行了,当然不会有任何效果。
    Job要结合IJobManager来使用
      

  5.   

    对了,这函数有返回值的
    public final boolean sleep()
    Returns:
    false if the job is currently running (and thus cannot be put to sleep), and true in all other cases
    你打印一下它的return看看,应该就是false了