tmf.core: Add a resolve method to IEventAspect with a block parameter
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Thu, 28 Apr 2016 13:21:49 +0000 (09:21 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Tue, 10 May 2016 00:41:46 +0000 (20:41 -0400)
That method can be implemented by aspects whose resolution depend on an
analysis and the result of the resolve may not be available at the time of
query.

Change-Id: I01f05b1eff4a5a6d56b9fd6375ba9ee7636e1a11
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/71603
Reviewed-by: Hudson CI
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/ITmfEventAspect.java

index 7cdd4e8de66ad89655c8b2292db4fe4918d9244a..47e42d4f6ac2f0ee878302a0472ca13c5d130dad 100644 (file)
@@ -13,6 +13,7 @@
 
 package org.eclipse.tracecompass.tmf.core.event.aspect;
 
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 
@@ -67,12 +68,31 @@ public interface ITmfEventAspect<T> {
      * events of your own trace type. It is perfectly fine to return
      * {@link #EMPTY_STRING} for event types you don't support.
      *
-     * You also can (and should) provide a more specific return type than
-     * Object.
-     *
      * @param event
      *            The event to process
      * @return The resulting tidbit of information for this event.
      */
     @Nullable T resolve(ITmfEvent event);
+
+    /**
+     * This method will return the same result as {@link #resolve(ITmfEvent)},
+     * but it allows to specify whether to wait until the requested information
+     * is available.
+     *
+     * @param event
+     *            The event to process
+     * @param block
+     *            Whether to block if the requested information is not yet
+     *            available but will be later.
+     * @param monitor
+     *            The progress monitor, to be used by implementation to verify
+     *            the cancellation of the current thread
+     * @return The resulting tidbit of information for this event.
+     * @throws InterruptedException
+     *             If any thread has interrupted the current thread
+     * @since 2.0
+     */
+    default @Nullable T resolve(ITmfEvent event, boolean block, IProgressMonitor monitor) throws InterruptedException {
+        return resolve(event);
+    }
 }
This page took 0.027416 seconds and 5 git commands to generate.