mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 13:20:57 +00:00
Improved the logging
This commit is contained in:
1 parent
5f552b46b8
commit
4c7a1706d6
2 files changed
+10
-4
No files matched your search
+7
-1
@@ -20,6 +20,8 @@ public abstract class AbstractPartitioningParallelProcessor<InputType, WorkingTy
|
||||
private final Set<Processor<ResultType>> resultReceivers;
|
||||
private final ExecutorService executor;
|
||||
private final UnfinishedInstructionsCounter unfinishedInstructionsCounter;
|
||||
|
||||
private boolean gotAborted = false;
|
||||
|
||||
public AbstractPartitioningParallelProcessor(ExecutorService executor, Collection<Processor<ResultType>> resultReceivers) {
|
||||
this.executor = executor;
|
||||
@@ -41,7 +43,9 @@ public abstract class AbstractPartitioningParallelProcessor<InputType, WorkingTy
|
||||
forwardResultToReceivers(result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.FINEST, "An error occured during the processing of an instruction: ", e);
|
||||
if (!gotAborted || !(e instanceof InterruptedException)) {
|
||||
LOGGER.log(Level.FINEST, "An error occured during the processing of an instruction: ", e);
|
||||
}
|
||||
} finally {
|
||||
AbstractPartitioningParallelProcessor.this.unfinishedInstructionsCounter.decrement();
|
||||
}
|
||||
@@ -110,8 +114,10 @@ public abstract class AbstractPartitioningParallelProcessor<InputType, WorkingTy
|
||||
|
||||
@Override
|
||||
public void abort() {
|
||||
gotAborted = true;
|
||||
executor.shutdownNow();
|
||||
tellResultReceiversToAbort();
|
||||
LOGGER.log(Level.INFO, "The processing got aborted.");
|
||||
}
|
||||
|
||||
private void tellResultReceiversToAbort() {
|
||||
|
||||
+3
-3
@@ -29,7 +29,7 @@ public class ProcessorQuery<AggregatedType, DataSourceType> implements Query<Agg
|
||||
|
||||
private final Object monitorObject = new Object();
|
||||
private boolean workIsDone = false;
|
||||
private boolean processorTimedOut = true;
|
||||
private boolean processorTimedOut = false;
|
||||
|
||||
public ProcessorQuery(Executor executor, DataSourceType dataSource) {
|
||||
this.executor = executor;
|
||||
@@ -91,7 +91,7 @@ public class ProcessorQuery<AggregatedType, DataSourceType> implements Query<Agg
|
||||
}
|
||||
}
|
||||
workIsDone = false;
|
||||
processorTimedOut = true;
|
||||
processorTimedOut = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ public class ProcessorQuery<AggregatedType, DataSourceType> implements Query<Agg
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (monitorObject) {
|
||||
processorTimedOut = true;
|
||||
monitorObject.notify();
|
||||
}
|
||||
}
|
||||
@@ -134,7 +135,6 @@ public class ProcessorQuery<AggregatedType, DataSourceType> implements Query<Agg
|
||||
public void finish() throws InterruptedException {
|
||||
synchronized (monitorObject) {
|
||||
workIsDone = true;
|
||||
processorTimedOut = false;
|
||||
monitorObject.notify();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user