case IJob.CancelIfNotReady :
if (VERBOSE)
Util.verbose("-> NOT READY - cancelling - " + searchJob); //$NON-NLS-1$
if (VERBOSE)
Util.verbose("CANCELED concurrent job - " + searchJob); //$NON-NLS-1$
throw new OperationCanceledException();
case IJob.WaitUntilReady :
IProgressMonitor subProgress = null;
try {
int totalWork = 1000;
if (progress != null) {
subProgress = new SubProgressMonitor(progress, concurrentJobWork * 8 / 10);
subProgress.beginTask("", totalWork); //$NON-NLS-1$
concurrentJobWork = concurrentJobWork * 2 / 10;
}
// use local variable to avoid potential NPE (see bug 20435 NPE when searching java method
// and bug 42760 NullPointerException in JobManager when searching)
Thread t = this.processingThread;
int originalPriority = t == null ? -1 : t.getPriority();
try {
if (t != null)
t.setPriority(Thread.currentThread().getPriority());
synchronized(this) {
this.awaitingClients++;
}
IJob previousJob = null;
int awaitingJobsCount;
int lastJobsCount = totalWork;
float lastWorked = 0;
float totalWorked = 0;
while ((awaitingJobsCount = awaitingJobsCount()) > 0) {
if (subProgress != null && subProgress.isCanceled())
throw new OperationCanceledException();
IJob currentJob = currentJob();
// currentJob can be null when jobs have been added to the queue but job manager is not enabled
if (currentJob != null && currentJob != previousJob) {
if (VERBOSE)
Util.verbose("-> NOT READY - waiting until ready - " + searchJob);//$NON-NLS-1$