forked from j62/ctbrec
1
0
Fork 0

Change order how things are shutdown

This commit is contained in:
0xb00bface 2020-07-26 15:14:44 +02:00
parent d63c98cf36
commit 963f0f0f5f
1 changed files with 4 additions and 3 deletions

View File

@ -456,7 +456,7 @@ public class NextGenLocalRecorder implements Recorder {
recorderLock.unlock(); recorderLock.unlock();
} }
// wait for post-processing to finish // wait for downloads to finish
LOG.info("Waiting for downloads to finish"); LOG.info("Waiting for downloads to finish");
for (int i = 0; i < 60; i++) { for (int i = 0; i < 60; i++) {
if (!recordingProcesses.isEmpty()) { if (!recordingProcesses.isEmpty()) {
@ -471,11 +471,12 @@ public class NextGenLocalRecorder implements Recorder {
// shutdown threadpools // shutdown threadpools
try { try {
LOG.info("Shutting down pools"); LOG.info("Shutting down download pool");
downloadPool.shutdown(); downloadPool.shutdown();
ppPool.shutdown();
client.shutdown(); client.shutdown();
downloadPool.awaitTermination(1, TimeUnit.MINUTES); downloadPool.awaitTermination(1, TimeUnit.MINUTES);
LOG.info("Shutting down post-processing pool");
ppPool.shutdown();
int minutesToWait = 10; int minutesToWait = 10;
LOG.info("Waiting {} minutes (max) for post-processing to finish", minutesToWait); LOG.info("Waiting {} minutes (max) for post-processing to finish", minutesToWait);
ppPool.awaitTermination(minutesToWait, TimeUnit.MINUTES); ppPool.awaitTermination(minutesToWait, TimeUnit.MINUTES);