Merge branch 'master' into lttng-luna
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / ctfadaptor / CtfIterator.java
index befd10461cd188bd7bd09a130d82a3934623a1d4..9635d55a68481cdcd96f205b892e58bc95b7b23d 100644 (file)
@@ -13,7 +13,7 @@ package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
 import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
 
 /**
  * The CTF trace reader iterator.
@@ -122,7 +122,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
      * @return boolean
      * @since 2.0
      */
-    public boolean seek(final CtfLocationInfo ctfLocationData) {
+    public synchronized boolean seek(final CtfLocationInfo ctfLocationData) {
         boolean ret = false;
 
         /* Adjust the timestamp depending on the trace's offset */
@@ -139,11 +139,12 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
          * assign the location index correctly
          */
         long index = 0;
-        if (this.getCurrentEvent() != null) {
-            currTimestamp = this.getCurrentEvent().getTimestamp().getValue();
+        final CtfTmfEvent currentEvent = this.getCurrentEvent();
+        if (currentEvent != null) {
+            currTimestamp = currentEvent.getTimestamp().getValue();
 
             for (long i = 0; i < ctfLocationData.getIndex(); i++) {
-                if (currTimestamp == this.getCurrentEvent().getTimestamp().getValue()) {
+                if (currTimestamp == currentEvent.getTimestamp().getValue()) {
                     index++;
                 } else {
                     index = 0;
@@ -201,6 +202,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
     /**
      * Method setLocation.
      * @param location ITmfLocation<?>
+     * @since 3.0
      */
     @Override
     public void setLocation(final ITmfLocation location) {
@@ -246,7 +248,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
      * @return boolean successful or not
      */
     @Override
-    public boolean advance() {
+    public synchronized boolean advance() {
         long index = curLocation.getLocationInfo().getIndex();
         long timestamp = curLocation.getLocationInfo().getTimestamp();
         boolean ret = super.advance();
This page took 0.024596 seconds and 5 git commands to generate.