ECS: catch and report exceptions form preprocessing loop

This commit is contained in:
Jakub Valtar
2016-05-03 09:02:55 +02:00
parent 531a6aaaf3
commit 58e802b1da

View File

@@ -148,20 +148,25 @@ public class ErrorCheckerService {
PreprocessedSketch prevResult = PreprocessedSketch.empty();
while (running) {
try {
requestQueue.take(); // blocking until check requested
} catch (InterruptedException e) {
running = false;
break;
}
Messages.log("Starting error check");
prevResult = preprocessSketch(prevResult);
synchronized (requestLock) {
if (requestQueue.isEmpty()) {
preprocessingTask.complete(prevResult);
try {
requestQueue.take(); // blocking until check requested
} catch (InterruptedException e) {
running = false;
break;
}
Messages.log("Starting preprocessing");
prevResult = preprocessSketch(prevResult);
synchronized (requestLock) {
if (requestQueue.isEmpty()) {
Messages.log("Completing preprocessing");
preprocessingTask.complete(prevResult);
}
}
} catch (Exception e) {
Messages.loge("problem in error checker loop", e);
}
}