From: Geneviève Bastien Date: Thu, 28 Apr 2016 13:21:49 +0000 (-0400) Subject: tmf.core: Add a resolve method to IEventAspect with a block parameter X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=e2f5644360b0ff9198f406f36416f255f43a1a08;p=deliverable%2Ftracecompass.git tmf.core: Add a resolve method to IEventAspect with a block parameter 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 Reviewed-on: https://git.eclipse.org/r/71603 Reviewed-by: Hudson CI Tested-by: Bernd Hufmann Reviewed-by: Bernd Hufmann --- diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/ITmfEventAspect.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/ITmfEventAspect.java index 7cdd4e8de6..47e42d4f6a 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/ITmfEventAspect.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/ITmfEventAspect.java @@ -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 { * 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); + } }