tmf: Add dispose methods to the state and stats backends
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / statesystem / StateSystem.java
index b302e49d568efc239ab281388c409864a1052aa7..527f7eee64f222f6aa384c81fd72b8caad122688 100644 (file)
@@ -55,6 +55,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
     /* Latch tracking if the state history is done building or not */
     private final CountDownLatch finishedLatch = new CountDownLatch(1);
 
+    private boolean buildCancelled = false;
+
     /**
      * General constructor
      *
@@ -82,12 +84,22 @@ public class StateSystem implements ITmfStateSystemBuilder {
     }
 
     @Override
-    public void waitUntilBuilt() {
+    public boolean waitUntilBuilt() {
         try {
             finishedLatch.await();
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+        return !buildCancelled;
+    }
+
+    @Override
+    public synchronized void dispose() {
+        if (transState.isActive()) {
+            transState.setInactive();
+            buildCancelled = true;
+        }
+        backend.dispose();
     }
 
     //--------------------------------------------------------------------------
This page took 0.023823 seconds and 5 git commands to generate.