Package zmq
Class Ctx
java.lang.Object
zmq.Ctx
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
A class that holds the informations needed to forward channel in monitor sockets.static class
private static class
private static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private boolean
private final Map
<String, Ctx.Endpoint> private final Lock
private final Errno
private Thread.UncaughtExceptionHandler
private Thread.UncaughtExceptionHandler
private Ctx.ChannelForwardHolder
private int
private boolean
private static AtomicInteger
private int
private final Lock
private final MultiMap
<String, Ctx.PendingConnection> private Reaper
private static final int
private final Lock
private int
private IMailbox[]
private final Lock
private final List
<SocketBase> private final AtomicBoolean
(package private) static final int
private boolean
private final Mailbox
private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkTag()
Deprecated.(package private) IOThread
chooseIoThread
(long affinity) private void
Clean all empty referencesboolean
closeSelector
(Selector selector) private void
connectInprocSockets
(SocketBase bindSocket, Options bindOptions, Ctx.PendingConnection pendingConnection, Ctx.Side side) (package private) void
connectPending
(String addr, SocketBase bindSocket) createSocket
(int type) private void
destroy()
(package private) void
destroySocket
(SocketBase socket) errno()
(package private) Ctx.Endpoint
findEndpoint
(String addr) (package private) int
forwardChannel
(SelectableChannel channel) Forward a channel in a monitor socket.int
get
(int option) (package private) SelectableChannel
getForwardedChannel
(Integer handle) Retrieve a channel, using the handle returned byforwardChannel(SelectableChannel)
.(package private) ZObject
private void
boolean
isActive()
(package private) void
pendConnection
(String addr, Ctx.Endpoint endpoint, Pipe[] pipes) (package private) boolean
registerEndpoint
(String addr, Ctx.Endpoint endpoint) (package private) void
sendCommand
(int tid, Command command) boolean
set
(int option, int optval) void
InPoller.run()
, some non-fatal exceptions can be thrown.void
Set the handler invoked when aPoller
abruptly terminates due to an uncaught exception.(package private) final void
shutdown()
void
(package private) boolean
unregisterEndpoint
(String addr, SocketBase socket) (package private) void
unregisterEndpoints
(SocketBase socket)
-
Field Details
-
WAIT_FOREVER
private static final int WAIT_FOREVER- See Also:
-
active
private boolean active -
sockets
-
emptySlots
-
starting
-
terminating
private boolean terminating -
slotSync
-
selectors
-
reaper
-
ioThreads
-
slotCount
private int slotCount -
slots
-
termMailbox
-
endpoints
-
endpointsSync
-
maxSocketId
-
maxSockets
private int maxSockets -
ioThreadCount
private int ioThreadCount -
blocky
private boolean blocky -
optSync
-
selectorSync
-
TERM_TID
static final int TERM_TID- See Also:
-
REAPER_TID
private static final int REAPER_TID- See Also:
-
pendingConnections
-
ipv6
private boolean ipv6 -
errno
-
exhandler
-
exnotification
-
forwardHolder
-
-
Constructor Details
-
Ctx
public Ctx()
-
-
Method Details
-
destroy
- Throws:
IOException
-
isActive
public boolean isActive()- Returns:
- false if
terminate()
terminate() has been called.
-
checkTag
Deprecated.useisActive()
instead- Returns:
- false if
terminate()
terminate() has been called.
-
terminate
public void terminate() -
shutdown
final void shutdown() -
setUncaughtExceptionHandler
Set the handler invoked when aPoller
abruptly terminates due to an uncaught exception.It default to the value of
Thread.getDefaultUncaughtExceptionHandler()
- Parameters:
handler
- The object to use as this thread's uncaught exception handler. If null then this thread has no explicit handler.
-
getUncaughtExceptionHandler
- Returns:
- The handler invoked when a
Poller
abruptly terminates due to an uncaught exception.
-
setNotificationExceptionHandler
InPoller.run()
, some non-fatal exceptions can be thrown. This handler will be notified, so they can be logged.Default to
Throwable.printStackTrace()
- Parameters:
handler
- The object to use as this thread's handler for recoverable exceptions notifications.
-
getNotificationExceptionHandler
- Returns:
- The handler invoked when a non-fatal exceptions is thrown in zmq.poll.Poller#run()
-
set
public boolean set(int option, int optval) -
get
public int get(int option) -
createSocket
-
initSlots
private void initSlots() -
destroySocket
-
createSelector
-
closeSelector
-
getReaper
ZObject getReaper() -
sendCommand
-
chooseIoThread
-
registerEndpoint
-
unregisterEndpoint
-
unregisterEndpoints
-
findEndpoint
-
pendConnection
-
connectPending
-
connectInprocSockets
private void connectInprocSockets(SocketBase bindSocket, Options bindOptions, Ctx.PendingConnection pendingConnection, Ctx.Side side) -
errno
-
forwardChannel
Forward a channel in a monitor socket.- Parameters:
channel
- a channel to forward- Returns:
- the handle of the channel to be forwarded, used to retrieve it in
getForwardedChannel(Integer)
-
getForwardedChannel
Retrieve a channel, using the handle returned byforwardChannel(SelectableChannel)
. As WeakReference are used, if the channel was discarded and a GC ran, it will not be found and this method will return null.- Parameters:
handle
-- Returns:
-
cleanForwarded
private void cleanForwarded()Clean all empty references
-
isActive()
instead