org.zeromq
类 ZContext

java.lang.Object
  继承者 org.zeromq.ZContext
所有已实现的接口:
java.io.Closeable

public class ZContext
extends java.lang.Object
implements java.io.Closeable

ZContext provides a high-level ZeroMQ context management class The ZContext class wraps java org.zeromq.Context objects, which in turn wrap native 0MQ contexts. It manages open sockets in the context and automatically closes these before terminating the context. It provides a simple way to set the linger timeout on sockets, and configure contexts for number of I/O threads. Sets-up signal (interrupt) handling for the process.

另请参见:
czmq version

构造方法摘要
ZContext()
          Class Constructor
 
方法摘要
 void close()
           
 ZMQ.Socket createSocket(int type)
          Creates a new managed socket within this ZContext instance.
 void destroy()
          Destructor.
 void destroySocket(ZMQ.Socket s)
          Destroys managed socket within this context and remove from sockets list
 ZMQ.Context getContext()
           
 int getIoThreads()
           
 int getLinger()
           
 java.util.List<ZMQ.Socket> getSockets()
           
 boolean isMain()
           
 void setContext(ZMQ.Context ctx)
           
 void setIoThreads(int ioThreads)
           
 void setLinger(int linger)
           
 void setMain(boolean main)
           
static ZContext shadow(ZContext ctx)
          Creates new shadow context.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ZContext

public ZContext()
Class Constructor

方法详细信息

destroy

public void destroy()
Destructor. Call this to gracefully terminate context and close any managed 0MQ sockets


createSocket

public ZMQ.Socket createSocket(int type)
Creates a new managed socket within this ZContext instance. Use this to get automatic management of the socket at shutdown

参数:
type - socket type (see ZMQ static class members)
返回:
Newly created Socket object

destroySocket

public void destroySocket(ZMQ.Socket s)
Destroys managed socket within this context and remove from sockets list

参数:
s - org.zeromq.Socket object to destroy

shadow

public static ZContext shadow(ZContext ctx)
Creates new shadow context. Shares same underlying org.zeromq.Context instance but has own list of managed sockets, io thread count etc.

参数:
ctx - Original ZContext to create shadow of
返回:
New ZContext

getIoThreads

public int getIoThreads()
返回:
the ioThreads

setIoThreads

public void setIoThreads(int ioThreads)
参数:
ioThreads - the ioThreads to set

getLinger

public int getLinger()
返回:
the linger

setLinger

public void setLinger(int linger)
参数:
linger - the linger to set

isMain

public boolean isMain()
返回:
the main

setMain

public void setMain(boolean main)
参数:
main - the main to set

getContext

public ZMQ.Context getContext()
返回:
the context

setContext

public void setContext(ZMQ.Context ctx)
参数:
ctx - sets the underlying org.zeromq.Context associated with this ZContext wrapper object

getSockets

public java.util.List<ZMQ.Socket> getSockets()
返回:
the sockets

close

public void close()
指定者:
接口 java.io.Closeable 中的 close