Skip to content

Commit

Permalink
Revert automatic cleanups made in JobManager
Browse files Browse the repository at this point in the history
Revert unintentional changes made in
5919685

See eclipse-platform#1282 (comment)

Contributes to
eclipse-platform#664
  • Loading branch information
fedejeanne committed Apr 4, 2024
1 parent e2facf9 commit e4b5b9e
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,10 @@ protected boolean isBlocking(InternalJob runningJob) {
while (previous != null) {
// ignore jobs of lower priority (higher priority value means lower priority)
if (previous.getPriority() < runningJob.getPriority()) {
if (!previous.isSystem())
return true;
// implicit jobs should interrupt unless they act on behalf of system jobs
if (!previous.isSystem() || (previous instanceof ThreadJob && ((ThreadJob) previous).shouldInterrupt()))
if (previous instanceof ThreadJob && ((ThreadJob) previous).shouldInterrupt())
return true;
}
previous = previous.previous();
Expand Down Expand Up @@ -953,8 +955,10 @@ protected boolean join(InternalJob job, long timeout, IProgressMonitor monitor)
final Semaphore barrier;
synchronized (lock) {
int state = job.getState();
if (state == Job.NONE)
return true;
//don't join a waiting or sleeping job when suspended (deadlock risk)
if ((state == Job.NONE) || (suspended && state != Job.RUNNING))
if (suspended && state != Job.RUNNING)
return true;
//it's an error for a job to join itself
if (state == Job.RUNNING && job.getThread() == Thread.currentThread())
Expand Down Expand Up @@ -1053,8 +1057,10 @@ public void scheduled(IJobChangeEvent event) {
Job job = event.getJob();
if (family == null || job.belongsTo(family)) {
// don't add to list if job is being rescheduled
if (((JobChangeEvent) event).reschedule)
return;
// if job manager is suspended we only wait for running jobs
if (((JobChangeEvent) event).reschedule || isSuspended())
if (isSuspended())
return;
boolean added = jobs.add(job);
assert added;
Expand Down

0 comments on commit e4b5b9e

Please sign in to comment.