Removed some unnecessary nested locks

This commit is contained in:
0xboobface 2018-08-05 17:06:13 +02:00
parent dcbea85f76
commit 6357447a4a
1 changed files with 22 additions and 31 deletions

View File

@ -102,9 +102,6 @@ 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);
@ -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();
} }
} }