<Default Package>
Type monitor
Static actions available to monitors.
The monitor type provides static methods to configure the monitor instance or context they are called from. You cannot create instances of the monitor type.
Action summary |
void | static subscribe(string channelName)
Subscribe the calling context to the specified channel. |
void | static unsubscribe(string channelName)
Remove the subscription to the specified channel that this monitor instance has in the calling context. |
subscribe
void static subscribe(string channelName)
Subscribe the calling context to the specified channel.
All listeners in the same context as the calling monitor instance (including in other monitor instances) will receive and process events sent to the specified channel. The calling monitor instance owns the subscription. If the calling monitor instance terminates, the subscription ends.
Multiple monitor instances in the same context can subscribe to the same channel. Each event is delivered exactly once as long as any of the subscriptions are active. An event is not delivered once for each subscription.
-
Parameters:
-
channelName - The channel name to subscribe to.
unsubscribe
void static unsubscribe(string channelName)
Remove the subscription to the specified channel that this monitor instance has in the calling context.
If this was the last monitor instance subscribed to the channel, then the context will no longer receive or process events sent to this channel.
-
Parameters:
-
channelName - The channel name to unsubscribe from.
-
Throws:
- Throws IllegalStateException if you attempt to unsubscribe from a channel the monitor instance was not subscribed to.