Class TmfSignalManager
java.lang.Object
org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddIgnoredInboundSignal(Object listener, Class<? extends TmfSignal> signal) Ignore the inbound signal type for the specified listener.static voidaddIgnoredOutboundSignal(Object source, Class<? extends TmfSignal> signal) Ignore the outbound signal type from the specified source.static voidclearIgnoredInboundSignalList(Object listener) Clear the list of ignored inbound signals for the listener.static voidclearIgnoredOutboundSignalList(Object source) Clear the list of ignored outbound signals for the source.static voidderegister(Object listener) De-register a listener object from the signal manager.static voiddispatchSignal(TmfSignal signal) Invokes the handling methods that listens to signals of a given type in the current thread.static voiddispatchSignalAsync(TmfSignal signal) Invokes the handling methods that listens to signals of a given type in a separate thread which will calldispatchSignal(TmfSignal).static voiddispose()Disposes the signal managerstatic voidRegister an object to the signal manager.static voidregisterVIP(Object listener) Register an object to the signal manager as a "VIP" listener.static voidremoveIgnoredInboundSignal(Object listener, Class<? extends TmfSignal> signal) Remove the signal from the list of inbound ignored signals for the specified listener if present.static voidremoveIgnoredOutboundSignal(Object source, Class<? extends TmfSignal> signal) Remove the signal from the list of ignored outbound signal for the specified source if present.
-
Constructor Details
-
TmfSignalManager
public TmfSignalManager()
-
-
Method Details
-
register
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 objectsignal- 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 ignoredsignal- The signal class to ignore- Since:
- 3.2
-
removeIgnoredOutboundSignal
Remove the signal from the list of ignored outbound signal for the specified source if present.- Parameters:
source- The source objectsignal- The signal class to remove from the ignore list- Since:
- 3.2
-
removeIgnoredInboundSignal
Remove the signal from the list of inbound ignored signals for the specified listener if present.- Parameters:
listener- The listener objectsignal- The signal class to remove from the ignore list- Since:
- 3.2
-
clearIgnoredOutboundSignalList
Clear the list of ignored outbound signals for the source.- Parameters:
source- The source object- Since:
- 3.2
-
clearIgnoredInboundSignalList
Clear the list of ignored inbound signals for the listener.- Parameters:
listener- The listener object- Since:
- 3.2
-
registerVIP
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
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
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
Invokes the handling methods that listens to signals of a given type in a separate thread which will calldispatchSignal(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
-