Class ZMonitor
java.lang.Object
org.zeromq.ZMonitor
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumerates types of monitoring events.private static classstatic enumThe code returned by handshake events, as generated byeventHandshakeXXX.static final classHigh-level representation of an event. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionZMonitor(ZContext ctx, ZMQ.Socket socket) Creates a monitoring actor for the given socket. -
Method Summary
Modifier and TypeMethodDescriptionfinal ZMonitoradd(ZMonitor.Event... events) Adds event types to monitor.final voidclose()Stops the monitoring and closes the actor.final voiddestroy()Stops the monitoring and closes the actor.final ZMonitor.ZEventGets the next event, blocking for it until available.final ZMonitor.ZEventnextEvent(boolean wait) Gets the next event, blocking for it until available if requested.final ZMonitor.ZEventnextEvent(int timeout) Gets the next event, blocking for it until available if requested.final ZMonitorremove(ZMonitor.Event... events) Removes event types from monitor.final ZMonitorstart()Starts the monitoring.final ZMonitorverbose(boolean verbose) Sets verbosity of the monitor.
-
Field Details
-
started
private boolean started -
START
- See Also:
-
CLOSE
- See Also:
-
VERBOSE
- See Also:
-
ADD_EVENTS
- See Also:
-
REMOVE_EVENTS
- See Also:
-
agent
-
exit
-
-
Constructor Details
-
ZMonitor
Creates a monitoring actor for the given socket.- Parameters:
ctx- the context relative to this actor. Not null.socket- the socket to monitor for events. Not null.
-
-
Method Details
-
start
Starts the monitoring. Event types have to be added before the start, or they will take no effect.- Returns:
- this instance.
-
close
Stops the monitoring and closes the actor. When returning from that call, ZMonitor will be no more active.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
destroy
public final void destroy()Stops the monitoring and closes the actor. When returning from that call, ZMonitor will be no more active. -
verbose
Sets verbosity of the monitor.- Parameters:
verbose- true for monitor to be verbose, otherwise false.- Returns:
- this instance.
-
add
Adds event types to monitor.- Parameters:
events- the types of events to monitor.- Returns:
- this instance.
-
remove
Removes event types from monitor.- Parameters:
events- the types of events to stop monitoring.- Returns:
- this instance.
-
nextEvent
Gets the next event, blocking for it until available.- Returns:
- the next monitored event or null if closed.
-
nextEvent
Gets the next event, blocking for it until available if requested.- Parameters:
wait- true to block until next event is available, false to immediately return with null if there is no event.- Returns:
- the next event or null if there is currently none.
-
nextEvent
Gets the next event, blocking for it until available if requested.- Parameters:
timeout- the time in milliseconds to wait for a message before returning null, -1 to block.- Returns:
- the next event or null if there is currently none after the specified timeout.
-