Fix UI freeze caused by OnlineMonitor
The lock to prevent concurrent access to the list models caused the app to freeze, if the models list contained many models, because the OnlineMonitor would block access until it checked the online state of every model.
This commit is contained in:
parent
093ca92b4a
commit
97e7466352
|
@ -166,7 +166,12 @@ public class LocalRecorder implements Recorder {
|
|||
|
||||
@Override
|
||||
public List<Model> getModelsRecording() {
|
||||
lock.lock();
|
||||
try {
|
||||
return Collections.unmodifiableList(new ArrayList<>(models));
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -308,8 +313,6 @@ public class LocalRecorder implements Recorder {
|
|||
public void run() {
|
||||
running = true;
|
||||
while (running) {
|
||||
lock.lock();
|
||||
try {
|
||||
for (Model model : getModelsRecording()) {
|
||||
try {
|
||||
if (!recordingProcesses.containsKey(model)) {
|
||||
|
@ -324,9 +327,6 @@ public class LocalRecorder implements Recorder {
|
|||
LOG.error("Couldn't check if model {} is online", model.getName(), e);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
try {
|
||||
if (running)
|
||||
|
|
Loading…
Reference in New Issue