From: Jean-Christian Kouame Date: Mon, 1 Feb 2016 22:15:41 +0000 (-0500) Subject: tmf : add waitForInitialization() to ITmfAnalysisModuleWithStateSystem X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=6537ccdd5618115fd243b40c003a5fd954ea0fec;p=deliverable%2Ftracecompass.git tmf : add waitForInitialization() to ITmfAnalysisModuleWithStateSystem Change-Id: Id6fc4792446dbec8e9cabe43ff743a596d23f1c0 Signed-off-by: Jean-Christian Kouame Reviewed-on: https://git.eclipse.org/r/65749 Reviewed-by: Genevieve Bastien Tested-by: Genevieve Bastien Reviewed-by: Hudson CI Reviewed-by: Matthew Khouzam --- diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/ITmfAnalysisModuleWithStateSystems.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/ITmfAnalysisModuleWithStateSystems.java index f6c0168b8a..e831f5cf4c 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/ITmfAnalysisModuleWithStateSystems.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/ITmfAnalysisModuleWithStateSystems.java @@ -41,4 +41,12 @@ public interface ITmfAnalysisModuleWithStateSystems extends IAnalysisModule { */ Iterable getStateSystems(); + /** + * Block the calling thread until the analysis module has been initialized. + * After this method returns, {@link #getStateSystem()} should not contain + * any null elements + * + * @since 2.0 + */ + void waitForInitialization(); } diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfStateSystemAnalysisModule.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfStateSystemAnalysisModule.java index 83ab1ceecf..da07ddf71b 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfStateSystemAnalysisModule.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfStateSystemAnalysisModule.java @@ -162,11 +162,7 @@ public abstract class TmfStateSystemAnalysisModule extends TmfAbstractAnalysisMo return fStateSystem; } - /** - * Block the calling thread until the analysis module has been initialized. - * After this method returns, {@link #getStateSystem()} should not return - * null anymore. - */ + @Override public void waitForInitialization() { try { fInitialized.await(); diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statistics/TmfStatisticsModule.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statistics/TmfStatisticsModule.java index 1996a05abf..d1281311c6 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statistics/TmfStatisticsModule.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statistics/TmfStatisticsModule.java @@ -66,6 +66,7 @@ public class TmfStatisticsModule extends TmfAbstractAnalysisModule /** * Wait until the analyses/state systems underneath are ready to be queried. */ + @Override public void waitForInitialization() { try { fInitialized.await(); diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/TmfStateSystemViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/TmfStateSystemViewer.java index cb29e26020..e822c93959 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/TmfStateSystemViewer.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/TmfStateSystemViewer.java @@ -37,7 +37,6 @@ import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue; import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler; import org.eclipse.tracecompass.tmf.core.signal.TmfTimestampFormatUpdateSignal; import org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems; -import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule; import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp; import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; @@ -212,10 +211,7 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer { for (ITmfAnalysisModuleWithStateSystems module : modules) { /* Just schedule the module, the data will be filled when available */ module.schedule(); - if (module instanceof TmfStateSystemAnalysisModule) { - // TODO: add this method to ITmfAnalysisModuleWithStateSystems - ((TmfStateSystemAnalysisModule) module).waitForInitialization(); - } + module.waitForInitialization(); for (ITmfStateSystem ss : module.getStateSystems()) { traceEntry.addChild(new StateSystemEntry(ss)); }