forked from j62/ctbrec
Don't start recordings, if the recorder has been shut down
This commit is contained in:
parent
ee3ae3ef43
commit
77fa7eba40
|
@ -159,6 +159,11 @@ public class LocalRecorder implements Recorder {
|
|||
}
|
||||
|
||||
private void startRecordingProcess(Model model) throws IOException {
|
||||
if(!recording) {
|
||||
// recorder is not in recording mode
|
||||
return;
|
||||
}
|
||||
|
||||
if(model.isSuspended()) {
|
||||
LOG.info("Recording for model {} is suspended.", model);
|
||||
return;
|
||||
|
@ -214,12 +219,15 @@ public class LocalRecorder implements Recorder {
|
|||
}
|
||||
|
||||
private void stopRecordingProcess(Model model) {
|
||||
LOG.debug("Stopping recording for {}", model);
|
||||
Download download = recordingProcesses.get(model);
|
||||
recordingProcesses.remove(model);
|
||||
fireRecordingStateChanged(download.getTarget(), STOPPED, model, download.getStartTime());
|
||||
|
||||
Runnable stopAndThePostProcess = () -> {
|
||||
LOG.debug("Stopping download for {}", model);
|
||||
download.stop();
|
||||
LOG.debug("Running post-processing for {}", model);
|
||||
createPostProcessor(download).run();
|
||||
};
|
||||
ppThreadPool.submit(stopAndThePostProcess);
|
||||
|
@ -284,6 +292,11 @@ public class LocalRecorder implements Recorder {
|
|||
LOG.debug("Stopping all recording processes");
|
||||
stopRecordingProcesses();
|
||||
ppThreadPool.shutdown();
|
||||
try {
|
||||
ppThreadPool.awaitTermination(5, TimeUnit.MINUTES);
|
||||
} catch (InterruptedException e) {
|
||||
LOG.error("Couldn't wait for post-processing to finish. Some recordings might be broken!");
|
||||
}
|
||||
client.shutdown();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue