forked from j62/ctbrec
Removed some unnecessary nested locks
This commit is contained in:
parent
dcbea85f76
commit
6357447a4a
|
@ -102,16 +102,13 @@ public class LocalRecorder implements Recorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startRecordingProcess(Model model) throws IOException {
|
private void startRecordingProcess(Model model) throws IOException {
|
||||||
lock.lock();
|
|
||||||
LOG.debug("Waiting for lock to restart recording for {}", model.getName());
|
|
||||||
try {
|
|
||||||
LOG.debug("Restart recording for model {}", model.getName());
|
LOG.debug("Restart recording for model {}", model.getName());
|
||||||
if(recordingProcesses.containsKey(model)) {
|
if (recordingProcesses.containsKey(model)) {
|
||||||
LOG.error("A recording for model {} is already running", model);
|
LOG.error("A recording for model {} is already running", model);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!models.contains(model)) {
|
if (!models.contains(model)) {
|
||||||
LOG.info("Model {} has been removed. Restarting of recording cancelled.", model);
|
LOG.info("Model {} has been removed. Restarting of recording cancelled.", model);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -128,9 +125,6 @@ public class LocalRecorder implements Recorder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
} finally {
|
|
||||||
lock.unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopRecordingProcess(Model model) throws IOException {
|
private void stopRecordingProcess(Model model) throws IOException {
|
||||||
|
@ -204,7 +198,6 @@ public class LocalRecorder implements Recorder {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lock.lock();
|
|
||||||
boolean modelInRecordingList = models.contains(model);
|
boolean modelInRecordingList = models.contains(model);
|
||||||
boolean online = checkIfOnline(model);
|
boolean online = checkIfOnline(model);
|
||||||
if(modelInRecordingList && online) {
|
if(modelInRecordingList && online) {
|
||||||
|
@ -214,8 +207,6 @@ public class LocalRecorder implements Recorder {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Couldn't restart recording for model {}", model);
|
LOG.error("Couldn't restart recording for model {}", model);
|
||||||
} finally {
|
|
||||||
lock.unlock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue