Skip to content

Commit

Permalink
Fixed bug in JobManager shutdown method
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Warneke committed Aug 12, 2012
1 parent 5515b02 commit fa233cc
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ public class JobManager implements DeploymentManager, ExtendedManagementProtocol

private final static int FAILURERETURNCODE = -1;

private final AtomicBoolean isShutDown = new AtomicBoolean(false);
private final AtomicBoolean isShutdownInProgress = new AtomicBoolean(false);

private volatile boolean isShutDown = false;

/**
* Constructs a new job manager, starts its discovery service and its IPC service.
Expand Down Expand Up @@ -305,7 +307,7 @@ public void runTaskLoop() {

public void shutdown() {

if (this.isShutDown.compareAndSet(false, true)) {
if (!this.isShutdownInProgress.compareAndSet(false, true)) {
return;
}

Expand Down Expand Up @@ -355,7 +357,7 @@ public void shutdown() {
this.scheduler.shutdown();
}

this.isShutDown.set(true);
this.isShutDown = true;
LOG.debug("Shutdown of job manager completed");
}

Expand Down Expand Up @@ -1089,7 +1091,7 @@ public void run() {
*/
public boolean isShutDown() {

return this.isShutDown.get();
return this.isShutDown;
}

/**
Expand Down

0 comments on commit fa233cc

Please sign in to comment.