tmf: Add a ITmfStateSystem.waitUntilBuilt() method with timeout
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / statesystem / StateSystem.java
index b26245f95d5092f200aa1dfcfbd6e51a187936aa..5af4cd6a5afe6cf335d1101789008ae5a066a6bf 100644 (file)
@@ -19,6 +19,7 @@ import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
@@ -114,6 +115,17 @@ public class StateSystem implements ITmfStateSystemBuilder {
         }
     }
 
+    @Override
+    public boolean waitUntilBuilt(long timeout) {
+        boolean ret = false;
+        try {
+            ret = finishedLatch.await(timeout, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        return ret;
+    }
+
     @Override
     public synchronized void dispose() {
         isDisposed = true;
This page took 0.023512 seconds and 5 git commands to generate.