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 {
|
private void startRecordingProcess(Model model) throws IOException {
|
||||||
|
if(!recording) {
|
||||||
|
// recorder is not in recording mode
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(model.isSuspended()) {
|
if(model.isSuspended()) {
|
||||||
LOG.info("Recording for model {} is suspended.", model);
|
LOG.info("Recording for model {} is suspended.", model);
|
||||||
return;
|
return;
|
||||||
|
@ -214,12 +219,15 @@ public class LocalRecorder implements Recorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopRecordingProcess(Model model) {
|
private void stopRecordingProcess(Model model) {
|
||||||
|
LOG.debug("Stopping recording for {}", model);
|
||||||
Download download = recordingProcesses.get(model);
|
Download download = recordingProcesses.get(model);
|
||||||
recordingProcesses.remove(model);
|
recordingProcesses.remove(model);
|
||||||
fireRecordingStateChanged(download.getTarget(), STOPPED, model, download.getStartTime());
|
fireRecordingStateChanged(download.getTarget(), STOPPED, model, download.getStartTime());
|
||||||
|
|
||||||
Runnable stopAndThePostProcess = () -> {
|
Runnable stopAndThePostProcess = () -> {
|
||||||
|
LOG.debug("Stopping download for {}", model);
|
||||||
download.stop();
|
download.stop();
|
||||||
|
LOG.debug("Running post-processing for {}", model);
|
||||||
createPostProcessor(download).run();
|
createPostProcessor(download).run();
|
||||||
};
|
};
|
||||||
ppThreadPool.submit(stopAndThePostProcess);
|
ppThreadPool.submit(stopAndThePostProcess);
|
||||||
|
@ -284,6 +292,11 @@ public class LocalRecorder implements Recorder {
|
||||||
LOG.debug("Stopping all recording processes");
|
LOG.debug("Stopping all recording processes");
|
||||||
stopRecordingProcesses();
|
stopRecordingProcesses();
|
||||||
ppThreadPool.shutdown();
|
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();
|
client.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue