Class TmfSignalManager

java.lang.Object
org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager

public class TmfSignalManager extends Object
This class manages the set of signal listeners and the signals they are interested in. When a signal is broadcasted, the appropriate listeners signal handlers are invoked.
Version:
1.0
Author:
Francois Chouinard
  • Constructor Details

    • TmfSignalManager

      public TmfSignalManager()
  • Method Details

    • register

      public static void register(Object listener)
      Register an object to the signal manager. This object can then implement handler methods, marked with @TmfSignalHandler and with the expected signal type as parameter.
      Parameters:
      listener - The object that will be notified of new signals
    • addIgnoredOutboundSignal

      @NonNullByDefault public static void addIgnoredOutboundSignal(Object source, Class<? extends TmfSignal> signal)
      Ignore the outbound signal type from the specified source. One can ignore all signals by passing TmfSignal.class as the signal class.
      Parameters:
      source - The source object
      signal - The signal class to ignore
      Since:
      3.2
    • addIgnoredInboundSignal

      @NonNullByDefault public static void addIgnoredInboundSignal(Object listener, Class<? extends TmfSignal> signal)
      Ignore the inbound signal type for the specified listener. All signals can be ignored by passing TmfSignal.class.
      Parameters:
      listener - The listener object for which the signal must be ignored
      signal - The signal class to ignore
      Since:
      3.2
    • removeIgnoredOutboundSignal

      public static void removeIgnoredOutboundSignal(Object source, Class<? extends TmfSignal> signal)
      Remove the signal from the list of ignored outbound signal for the specified source if present.
      Parameters:
      source - The source object
      signal - The signal class to remove from the ignore list
      Since:
      3.2
    • removeIgnoredInboundSignal

      public static void removeIgnoredInboundSignal(Object listener, Class<? extends TmfSignal> signal)
      Remove the signal from the list of inbound ignored signals for the specified listener if present.
      Parameters:
      listener - The listener object
      signal - The signal class to remove from the ignore list
      Since:
      3.2
    • clearIgnoredOutboundSignalList

      public static void clearIgnoredOutboundSignalList(Object source)
      Clear the list of ignored outbound signals for the source.
      Parameters:
      source - The source object
      Since:
      3.2
    • clearIgnoredInboundSignalList

      public static void clearIgnoredInboundSignalList(Object listener)
      Clear the list of ignored inbound signals for the listener.
      Parameters:
      listener - The listener object
      Since:
      3.2
    • registerVIP

      public static void registerVIP(Object listener)
      Register an object to the signal manager as a "VIP" listener. All VIP listeners will all receive the signal before the manager moves on to the lowly, non-VIP listeners.
      Parameters:
      listener - The object that will be notified of new signals
    • deregister

      public static void deregister(Object listener)
      De-register a listener object from the signal manager. This means that its @TmfSignalHandler methods will no longer be called.
      Parameters:
      listener - The object to de-register
    • dispatchSignal

      public static void dispatchSignal(TmfSignal signal)
      Invokes the handling methods that listens to signals of a given type in the current thread. The list of handlers is built on-the-fly to allow for the dynamic creation/deletion of signal handlers. Since the number of signal handlers shouldn't be too high, this is not a big performance issue to pay for the flexibility. For synchronization purposes, the signal is bracketed by two synch signals.
      Parameters:
      signal - the signal to dispatch
    • dispatchSignalAsync

      public static void dispatchSignalAsync(TmfSignal signal)
      Invokes the handling methods that listens to signals of a given type in a separate thread which will call dispatchSignal(TmfSignal). If a signal is already processed the signal will be queued and dispatched after the ongoing signal finishes.
      Parameters:
      signal - the signal to dispatch
    • dispose

      public static void dispose()
      Disposes the signal manager