public class ZMonitor extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
ZMonitor.Event
Enumerates types of monitoring events.
|
static class |
ZMonitor.ZEvent
High-level representation of an event.
|
| Constructor and Description |
|---|
ZMonitor(ZContext ctx,
ZMQ.Socket socket)
Creates a monitoring actor for the given socket.
|
| Modifier and Type | Method and Description |
|---|---|
ZMonitor |
add(ZMonitor.Event... events)
Adds event types to monitor.
|
void |
close()
Stops the monitoring and closes the actor.
|
void |
destroy()
Stops the monitoring and closes the actor.
|
ZMonitor.ZEvent |
nextEvent()
Gets the next event, blocking for it until available.
|
ZMonitor.ZEvent |
nextEvent(boolean wait)
Gets the next event, blocking for it until available if requested.
|
ZMonitor.ZEvent |
nextEvent(int timeout)
Gets the next event, blocking for it until available if requested.
|
ZMonitor |
remove(ZMonitor.Event... events)
Removes event types from monitor.
|
ZMonitor |
start()
Starts the monitoring.
|
ZMonitor |
verbose(boolean verbose)
Sets verbosity of the monitor.
|
public ZMonitor(ZContext ctx, ZMQ.Socket socket)
ctx - the context relative to this actor. Not null.socket - the socket to monitor for events. Not null.public final ZMonitor start()
public final void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic final void destroy()
public final ZMonitor verbose(boolean verbose)
verbose - true for monitor to be verbose, otherwise false.public final ZMonitor add(ZMonitor.Event... events)
events - the types of events to monitor.public final ZMonitor remove(ZMonitor.Event... events)
events - the types of events to stop monitoring.public final ZMonitor.ZEvent nextEvent()
public final ZMonitor.ZEvent nextEvent(boolean wait)
wait - true to block until next event is available, false to immediately return with null if there is no event.public final ZMonitor.ZEvent nextEvent(int timeout)
timeout - the time in milliseconds to wait for a message before returning null, -1 to block.Copyright © 2020. All rights reserved.