ctf: Add error logging when a closed iterator is selected for reattribution
authorRaphaël Beamonte <raphael.beamonte@gmail.com>
Thu, 3 Sep 2015 22:25:02 +0000 (18:25 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Fri, 4 Sep 2015 20:02:25 +0000 (16:02 -0400)
In replaceRandomElement, a check has been added to create a new
iterator when encountering a closed one. This situation should
never happen, and so means that something is broken somewhere
else, e.g. that an ITmfContext hasn't been disposed properly.
This patch adds an error message log when that case is met to
allow further investigation and correction of the origin of
the problem.

Change-Id: Ib35f9906045f21042fbc9fea216a0e5da81221d3
Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
Reviewed-on: https://git.eclipse.org/r/55242
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/internal/tmf/ctf/core/trace/iterator/CtfIteratorManager.java

index 315eaf6914ed1b2c55028a1ca74102fbe802a3e8..fabde12231415c76c6aec14af6de319d71693a86 100644 (file)
@@ -20,6 +20,7 @@ import java.util.Random;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
+import org.eclipse.tracecompass.internal.tmf.ctf.core.Activator;
 import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
 import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
@@ -184,8 +185,11 @@ public class CtfIteratorManager {
             if (elem.isClosed()) {
                 /*
                  * In case the iterator streams have been closed, we need to
-                 * replace it by a fresh new one to access the trace.
+                 * replace it by a fresh new one to access the trace. We also
+                 * report that as an error as it should not happen.
                  */
+                Activator.getDefault().logError("Found closed iterator in iterator manager for trace " + victim.getTrace()); //$NON-NLS-1$
+
                 elem.dispose();
                 elem = (CtfIterator) fTrace.createIterator();
             }
This page took 0.041349 seconds and 5 git commands to generate.