Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Montplaisir2014-09-10 20:14:29 +0000
committerAlexandre Montplaisir2014-09-15 23:12:44 +0000
commitfecdc7fcd72967435ffccc320229b0bdf67384a9 (patch)
tree645e2b971b51519654dd320846312eb1c52ed331
parent25a1589d03a9ae04419d7a9b3622d35ffb628332 (diff)
downloadorg.eclipse.linuxtools-fecdc7fcd72967435ffccc320229b0bdf67384a9.tar.gz
org.eclipse.linuxtools-fecdc7fcd72967435ffccc320229b0bdf67384a9.tar.xz
org.eclipse.linuxtools-fecdc7fcd72967435ffccc320229b0bdf67384a9.zip
tmf: Correctly dispose sub-components of a partial history backend
This will avoid lingering "event handler" threads when using partial state histories. Change-Id: I6044faa1c41a634e605161858b03ffb37b9e97ac Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-on: https://git.eclipse.org/r/33221 Tested-by: Hudson CI Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java13
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialStateSystem.java10
2 files changed, 17 insertions, 6 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java
index 6eed80aae0..f225edeb52 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java
@@ -19,6 +19,7 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.CountDownLatch;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem;
import org.eclipse.linuxtools.statesystem.core.backend.IStateHistoryBackend;
import org.eclipse.linuxtools.statesystem.core.exceptions.AttributeNotFoundException;
@@ -59,22 +60,22 @@ public class PartialHistoryBackend implements IStateHistoryBackend {
* A partial history needs the state input plugin to re-generate state
* between checkpoints.
*/
- private final ITmfStateProvider partialInput;
+ private final @NonNull ITmfStateProvider partialInput;
/**
* Fake state system that is used for partially rebuilding the states (when
* going from a checkpoint to a target query timestamp).
*/
- private final PartialStateSystem partialSS;
+ private final @NonNull PartialStateSystem partialSS;
/** Reference to the "real" state history that is used for storage */
- private final IStateHistoryBackend innerHistory;
+ private final @NonNull IStateHistoryBackend innerHistory;
/** Checkpoints map, <Timestamp, Rank in the trace> */
- private final TreeMap<Long, Long> checkpoints = new TreeMap<>();
+ private final @NonNull TreeMap<Long, Long> checkpoints = new TreeMap<>();
/** Latch tracking if the initial checkpoint registration is done */
- private final CountDownLatch checkpointsReady = new CountDownLatch(1);
+ private final @NonNull CountDownLatch checkpointsReady = new CountDownLatch(1);
private final long granularity;
@@ -183,6 +184,8 @@ public class PartialHistoryBackend implements IStateHistoryBackend {
@Override
public void dispose() {
+ partialInput.dispose();
+ partialSS.dispose();
innerHistory.dispose();
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialStateSystem.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialStateSystem.java
index 6dd273bc7d..1a7ede3f9a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialStateSystem.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialStateSystem.java
@@ -72,12 +72,20 @@ public class PartialStateSystem extends StateSystem {
return realStateSystem;
}
+ // ------------------------------------------------------------------------
+ // Publicized non-API methods
+ // ------------------------------------------------------------------------
+
@Override
public void replaceOngoingState(List<ITmfStateInterval> ongoingIntervals) {
- /* We simply publicize StateSystem's method */
super.replaceOngoingState(ongoingIntervals);
}
+ @Override
+ public synchronized void dispose() {
+ super.dispose();
+ }
+
// ------------------------------------------------------------------------
// Methods regarding the query lock
// ------------------------------------------------------------------------

Back to the top