Skip to content

Commit

Permalink
#526 wait some time for termination, when gracefully shutdown. So som…
Browse files Browse the repository at this point in the history
…e job operation can be finished.
  • Loading branch information
heziai committed Oct 24, 2018
1 parent 0dacbbc commit 5373f5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public void shutdown() {
JobType.SHELL_JOB.name());
} else {
abort();
scheduler.awaitTermination(500L);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

/**
* @author chembo.huang
Expand Down Expand Up @@ -57,6 +58,14 @@ public boolean isTerminated() {
return executor.isTerminated();
}

public void awaitTermination(long timeout) {
try {
executor.awaitTermination(timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}

public void triggerJob() {
saturnQuartzWorker.trigger();
}
Expand Down

0 comments on commit 5373f5d

Please sign in to comment.