From daf57da1416799a68902e399762463d0a062f7ec Mon Sep 17 00:00:00 2001 From: Christian Wulf <chw@informatik.uni-kiel.de> Date: Sun, 6 Jul 2014 05:18:15 +0200 Subject: [PATCH] fixed concurrency bug in TraceReductionFilter --- .../traceReduction/TraceReductionFilter.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceReductionFilter.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceReductionFilter.java index 48570a30..f9484eb6 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceReductionFilter.java +++ b/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceReductionFilter.java @@ -60,17 +60,14 @@ public class TraceReductionFilter extends ConsumerStage<TraceEventRecords, Trace } private void countSameTraces(final TraceEventRecords traceEventRecords, final long timestamp) { - TraceAggregationBuffer traceBuffer = this.trace2buffer.get(traceEventRecords); - if (traceBuffer == null) { - synchronized (this.trace2buffer) { - traceBuffer = this.trace2buffer.get(traceEventRecords); - if (traceBuffer == null) { // NOCS (DCL) - traceBuffer = new TraceAggregationBuffer(timestamp, traceEventRecords); - this.trace2buffer.put(traceEventRecords, traceBuffer); - } + synchronized (this.trace2buffer) { + TraceAggregationBuffer traceBuffer = this.trace2buffer.get(traceEventRecords); + if (traceBuffer == null) { + traceBuffer = new TraceAggregationBuffer(timestamp, traceEventRecords); + this.trace2buffer.put(traceEventRecords, traceBuffer); } + traceBuffer.count(); } - traceBuffer.count(); } @Override -- GitLab