public class ZContext extends Object implements Closeable
| Constructor and Description |
|---|
ZContext()
Class Constructor
|
ZContext(int ioThreads) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
closeSelector(Selector selector)
Deprecated.
createSelector() was exposed by mistake. while waiting for the API to disappear, this method is provided to allow releasing resources. |
ZMQ.Poller |
createPoller(int size) |
Selector |
createSelector()
Deprecated.
this was exposed by mistake.
|
ZMQ.Socket |
createSocket(int type)
Deprecated.
|
ZMQ.Socket |
createSocket(SocketType type)
Creates a new managed socket within this ZContext instance.
|
void |
destroy()
Destructor.
|
void |
destroySocket(ZMQ.Socket s)
Deprecated.
Not to be used any more.
ZMQ.Socket handle
the close itself. It also override linger settings. |
ZMQ.Socket |
fork(ZThread.IAttachedRunnable runnable,
Object... args)
Create an attached thread, An attached thread gets a ctx and a PAIR pipe back to its
parent.
|
ZMQ.Context |
getContext() |
int |
getIoThreads() |
int |
getLinger() |
Thread.UncaughtExceptionHandler |
getNotificationExceptionHandler() |
List<ZMQ.Socket> |
getSockets()
Return a copy of the list of currently open sockets.
|
Thread.UncaughtExceptionHandler |
getUncaughtExceptionHandler() |
boolean |
isClosed() |
boolean |
isEmpty() |
boolean |
isMain() |
void |
setContext(ZMQ.Context ctx)
Deprecated.
This value should not be changed after the ZContext is initialized.
|
void |
setIoThreads(int ioThreads)
Deprecated.
This value should not be changed after the context is initialized.
|
void |
setLinger(int linger) |
void |
setMain(boolean main)
Deprecated.
This value should not be changed after the context is initialized.
|
void |
setNotificationExceptionHandler(Thread.UncaughtExceptionHandler handler)
In
Poller.run(), some non-fatal exceptions can be thrown. |
void |
setRcvHWM(int rcvhwm)
Set initial receive HWM for all new normal sockets created in context.
|
void |
setSndHWM(int sndhwm)
Set initial receive HWM for all new normal sockets created in context.
|
void |
setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler handler)
Set the handler invoked when a
Poller abruptly terminates due to an uncaught exception. |
ZContext |
shadow()
Creates new shadow context.
|
static ZContext |
shadow(ZContext ctx)
Deprecated.
use the instance method directly
|
public ZContext()
public ZContext(int ioThreads)
public void destroy()
public ZMQ.Socket createSocket(SocketType type)
The newly created socket will inherited it's linger value from the one defined for this context.
type - socket type@Deprecated public ZMQ.Socket createSocket(int type)
createSocket(SocketType)type - socket type (see ZMQ static class members)@Deprecated public void destroySocket(ZMQ.Socket s)
ZMQ.Socket handle
the close itself. It also override linger settings.s - ZMQ.Socket object to destroy@Deprecated public Selector createSelector()
closeSelector(Selector).@Deprecated public void closeSelector(Selector selector)
createSelector() was exposed by mistake. while waiting for the API to disappear, this method is provided to allow releasing resources.selector - the selector to close. It needs to have been created by createSelector().public ZMQ.Poller createPoller(int size)
@Deprecated public static ZContext shadow(ZContext ctx)
ctx - Original ZContext to create shadow ofpublic ZContext shadow()
public ZMQ.Socket fork(ZThread.IAttachedRunnable runnable, Object... args)
runnable - attached threadargs - forked runnable argspublic int getIoThreads()
@Deprecated public void setIoThreads(int ioThreads)
ioThreads - the number of ioThreads to setpublic int getLinger()
public void setLinger(int linger)
linger - the linger that will inherited by created socket.public void setRcvHWM(int rcvhwm)
rcvhwm - the rcvhwmpublic void setSndHWM(int sndhwm)
sndhwm - the sndhwmpublic void setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler handler)
Poller abruptly terminates due to an uncaught exception.
It default to the value of Thread.getDefaultUncaughtExceptionHandler()
handler - The object to use as this thread's uncaught exception handler. If null then this thread has no explicit handler.public Thread.UncaughtExceptionHandler getUncaughtExceptionHandler()
Poller abruptly terminates due to an uncaught exception.public void setNotificationExceptionHandler(Thread.UncaughtExceptionHandler handler)
Poller.run(), some non-fatal exceptions can be thrown. This handler will be notified, so they can
be logged.
Default to Throwable.printStackTrace()
handler - The object to use as this thread's handler for recoverable exceptions notifications.public Thread.UncaughtExceptionHandler getNotificationExceptionHandler()
public boolean isMain()
public boolean isEmpty()
@Deprecated public void setMain(boolean main)
main - whether or not the context is being set to mainpublic ZMQ.Context getContext()
@Deprecated public void setContext(ZMQ.Context ctx)
ctx - sets the underlying zmq.Context associated with this ZContext wrapper objectpublic List<ZMQ.Socket> getSockets()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic boolean isClosed()
Copyright © 2022. All rights reserved.