tmf: Fix visibility warning with TmfRequestExecutor
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 14 Aug 2012 17:45:44 +0000 (13:45 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Wed, 15 Aug 2012 14:30:39 +0000 (10:30 -0400)
TmfDataProvider.fExecutor is protected, but TmfRequestExecutor
is not part of the public API. This means any class from another
plugin extending TmfDataProvider couldn't access the fExecutor.

Solve this by making the fExecutor field private, and supplying
protected access methods.

Change-Id: Ia3df1247fe2a6c98c87048bb17c9bc3529abfd47
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/7223
Reviewed-by: Bernd Hufmann <bhufmann@gmail.com>
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfDataProvider.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java

index 5ae7bd90f6693b7e261af9f2012930cd3d00f981..0b2e22cdc8ea1b7cab4422ab4c9c110b5594d980 100644 (file)
@@ -67,7 +67,7 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr
 
     protected int fQueueSize = DEFAULT_QUEUE_SIZE;
     protected BlockingQueue<ITmfEvent> fDataQueue;
-    protected TmfRequestExecutor fExecutor;
+    private TmfRequestExecutor fExecutor;
 
     private int fSignalDepth = 0;
     private final Object fLock = new Object();
@@ -470,6 +470,26 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr
         return request.isCompleted() || nbRead >= request.getNbRequested();
     }
 
+    // ------------------------------------------------------------------------
+    // Pass-through's to the request executor
+    // ------------------------------------------------------------------------
+
+    /**
+     * @return the shutdown state (i.e. if it is accepting new requests)
+     * @since 2.0
+     */
+    protected boolean executorIsShutdown() {
+        return fExecutor.isShutdown();
+    }
+
+    /**
+     * @return the termination state
+     * @since 2.0
+     */
+    protected boolean executorIsTerminated() {
+        return fExecutor.isTerminated();
+    }
+
     // ------------------------------------------------------------------------
     // Signal handlers
     // ------------------------------------------------------------------------
index d10ff9d7a3eed83a7247879cb533d4c544e44580..d0b70fa17203b162edf1c3259d61f8a2ca15f4aa 100644 (file)
@@ -461,7 +461,7 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
 
             @Override
             public void run() {
-                while (!fExecutor.isShutdown()) {
+                while (!executorIsShutdown()) {
                     if (!getIndexer().isIndexing()) {
                         ITmfTimestamp startTimestamp = TmfTimestamp.BIG_CRUNCH;
                         ITmfTimestamp endTimestamp = TmfTimestamp.BIG_BANG;
This page took 0.026336 seconds and 5 git commands to generate.