Skip to content

Commit

Permalink
Merge 12ba985 into 3157162
Browse files Browse the repository at this point in the history
  • Loading branch information
efonsell committed Apr 18, 2020
2 parents 3157162 + 12ba985 commit 320f1a6
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class WorkflowDispatcher implements Runnable {
private static final Logger logger = getLogger(WorkflowDispatcher.class);
private static final PeriodicLogger periodicLogger = new PeriodicLogger(logger, 60);

private volatile boolean started;
private volatile boolean shutdownRequested;
private volatile boolean running;
private volatile boolean paused;
Expand Down Expand Up @@ -68,7 +67,6 @@ public WorkflowDispatcher(WorkflowInstanceExecutor executor, WorkflowInstanceDao
public void run() {
logger.info("Dispacther started.");
try {
started = true;
workflowDefinitions.postProcessWorkflowDefinitions();
running = true;
while (!shutdownRequested) {
Expand Down Expand Up @@ -101,20 +99,22 @@ public void run() {
}
}
} finally {
running = false;
shutdownPool();
executorDao.markShutdown();
running = false;
logger.info("Shutdown completed.");
shutdownDone.countDown();
}
}

public void shutdown() {
shutdownRequested = true;
if (started && shutdownDone.getCount() > 0) {
logger.info("Shutdown initiated.");
if (running) {
if (!shutdownRequested) {
logger.info("Initiating shutdown.");
shutdownRequested = true;
}
try {
shutdownDone.await();
logger.info("Shutdown completed.");
} catch (@SuppressWarnings("unused") InterruptedException e) {
logger.warn("Shutdown interrupted.");
}
Expand Down

0 comments on commit 320f1a6

Please sign in to comment.