I am trying to run multiple Jobs on my java code. They use the IProgressMonitor to update the progress bar.
Job job = new Job("My first job") {
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask("start task", 100);
//long running Hibernate save operation
monitor.done();
return Status.OK_STATUS;
}
};
job.setUser(false);
job.schedule();
I then proceed to run a second Job in a different class the same way. So the second one job will just wait until the first one is done. Is there a way to either run two at the same time, or to force the first one to pause so that the second one can run? If not, is there a way to run the progress monitor in a thread instead of a job? I tried making my classes runnable and putting the jobs in the run method, but that has the same result. Thanks.
By default multiple Jobs do run at the same time using a pool of threads handling by the Eclipse Job manager.
You actually have to use a job scheduling rule to prevent different Jobs running at once.
Of course if one Job is doing something very processor intensive other Jobs may not get much done while it runs.