public class ManagedContext extends Object implements Context
| Constructor and Description |
|---|
ManagedContext() |
ManagedContext(int ioThreads) |
ManagedContext(org.zeromq.ZMQ.Context context) |
ManagedContext(org.zeromq.ZMQ.Context context,
boolean termContext) |
| Modifier and Type | Method and Description |
|---|---|
BeaconReactorBuilder |
buildBeaconReactor()
Create a new BeaconReactor, which will send and receive UDP beacons
on a broadcast address, with event-driven handling of received beacons.
|
BinaryStarReactorBuilder |
buildBinaryStarReactor()
Create a new BinaryStarReactor, which will create one half of an HA-pair
with event-driven polling of a client Socket.
|
BinaryStarSocketBuilder |
buildBinaryStarSocket()
Create a ØMQ Socket, backed by a background agent that is connecting
to a BinaryStarReactor HA-pair.
|
CloneClientBuilder |
buildCloneClient()
Create a new CloneClient, connected to an HA-pair, for publishing key/value data
to anonymous peers.
|
CloneServerBuilder |
buildCloneServer()
Create a new CloneServer, which will create one half of an HA-pair
for distributing key/value data to clients.
|
DeviceBuilder |
buildDevice(DeviceType deviceType)
Create a ØMQ Device of type DeviceType, which will bridge two networks
together using patterns for specific SocketTypes.
|
PollerBuilder |
buildPoller()
Create a new Poller, which will allow callback-based polling of Sockets.
|
ReactorBuilder |
buildReactor()
Create a new Reactor, which will allow event-driven and timer-based
polling of Sockets.
|
SocketBuilder |
buildSocket(SocketType type)
Create a ØMQ Socket of type SocketType
|
void |
close()
Close the context and any open sockets.
|
void |
destroySocket(Socket socket) |
Socket |
fork(Backgroundable backgroundable)
Run a background thread with an inproc PAIR socket for communication.
|
void |
fork(Socket socket,
Backgroundable backgroundable)
Run a background thread using the given socket for communication.
|
void |
forward(Socket frontEnd,
Socket backEnd)
Create a ØMQ proxy and start it up on another thread that exits when the
context is closed.
|
int |
getFullVersion() |
Collection<Socket> |
getSockets() |
String |
getVersionString() |
org.zeromq.ZMQ.Context |
getZMQContext() |
Pollable |
newPollable(SelectableChannel channel,
PollerType... options)
Create a new Pollable from the socket, with the requested options.
|
Pollable |
newPollable(Socket socket,
PollerType... options)
Create a new Pollable from the socket, with the requested options.
|
org.zeromq.ZMQ.Poller |
newZmqPoller()
Deprecated.
|
org.zeromq.ZMQ.Poller |
newZmqPoller(int initialNumberOfItems)
Deprecated.
|
void |
proxy(Socket frontEnd,
Socket backEnd)
Create a ØMQ proxy and start it up.
|
void |
queue(Socket frontEnd,
Socket backEnd)
|
ManagedContext |
shadow()
Create a new Context with the same underlying ØMQ context, with an empty
(separate) list of managed Sockets and Backgroundables.
|
void |
terminate()
Asynchronously terminate the context without closing any open sockets,
forcing pollers and waiters to abort.
|
public ManagedContext()
public ManagedContext(int ioThreads)
public ManagedContext(org.zeromq.ZMQ.Context context)
public ManagedContext(org.zeromq.ZMQ.Context context,
boolean termContext)
public org.zeromq.ZMQ.Context getZMQContext()
public Collection<Socket> getSockets()
public void destroySocket(Socket socket)
public ManagedContext shadow()
ContextThe returned context will not attempt to terminate the underlying ØMQ context when closed, and will only close managed sockets, etc.
public void close()
Contextpublic void terminate()
Contextpublic SocketBuilder buildSocket(SocketType type)
ContextbuildSocket in interface Contexttype - socket typepublic String getVersionString()
getVersionString in interface Contextpublic int getFullVersion()
getFullVersion in interface Contextpublic PollerBuilder buildPoller()
ContextbuildPoller in interface ContextPollable,
PollerType@Deprecated public org.zeromq.ZMQ.Poller newZmqPoller(int initialNumberOfItems)
@Deprecated public org.zeromq.ZMQ.Poller newZmqPoller()
public Pollable newPollable(Socket socket, PollerType... options)
ContextnewPollable in interface Contextsocket - A socket to wrap for pollingoptions - Polling options (IN, OUT, ERROR)public Pollable newPollable(SelectableChannel channel, PollerType... options)
ContextnewPollable in interface Contextchannel - A channel to wrap for pollingoptions - Polling options (IN, OUT, ERROR)public ReactorBuilder buildReactor()
ContextbuildReactor in interface Contextpublic BinaryStarReactorBuilder buildBinaryStarReactor()
ContextbuildBinaryStarReactor in interface Contextpublic BinaryStarSocketBuilder buildBinaryStarSocket()
ContextbuildBinaryStarSocket in interface Contextpublic CloneServerBuilder buildCloneServer()
ContextbuildCloneServer in interface Contextpublic CloneClientBuilder buildCloneClient()
ContextbuildCloneClient in interface Contextpublic BeaconReactorBuilder buildBeaconReactor()
ContextbuildBeaconReactor in interface Contextpublic DeviceBuilder buildDevice(DeviceType deviceType)
ContextbuildDevice in interface ContextdeviceType - The device type, specifying the pattern to usepublic void proxy(Socket frontEnd, Socket backEnd)
Contextpublic void forward(Socket frontEnd, Socket backEnd)
Contextpublic Socket fork(Backgroundable backgroundable)
Contextpublic void fork(Socket socket, Backgroundable backgroundable)
ContextCopyright © 2019. All rights reserved.