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()
Context
The returned context will not attempt to terminate the underlying ØMQ context when closed, and will only close managed sockets, etc.
public void close()
Context
public void terminate()
Context
public SocketBuilder buildSocket(SocketType type)
Context
buildSocket
in interface Context
type
- socket typepublic String getVersionString()
getVersionString
in interface Context
public int getFullVersion()
getFullVersion
in interface Context
public PollerBuilder buildPoller()
Context
buildPoller
in interface Context
Pollable
,
PollerType
@Deprecated public org.zeromq.ZMQ.Poller newZmqPoller(int initialNumberOfItems)
@Deprecated public org.zeromq.ZMQ.Poller newZmqPoller()
public Pollable newPollable(Socket socket, PollerType... options)
Context
newPollable
in interface Context
socket
- A socket to wrap for pollingoptions
- Polling options (IN, OUT, ERROR)public Pollable newPollable(SelectableChannel channel, PollerType... options)
Context
newPollable
in interface Context
channel
- A channel to wrap for pollingoptions
- Polling options (IN, OUT, ERROR)public ReactorBuilder buildReactor()
Context
buildReactor
in interface Context
public BinaryStarReactorBuilder buildBinaryStarReactor()
Context
buildBinaryStarReactor
in interface Context
public BinaryStarSocketBuilder buildBinaryStarSocket()
Context
buildBinaryStarSocket
in interface Context
public CloneServerBuilder buildCloneServer()
Context
buildCloneServer
in interface Context
public CloneClientBuilder buildCloneClient()
Context
buildCloneClient
in interface Context
public BeaconReactorBuilder buildBeaconReactor()
Context
buildBeaconReactor
in interface Context
public DeviceBuilder buildDevice(DeviceType deviceType)
Context
buildDevice
in interface Context
deviceType
- The device type, specifying the pattern to usepublic void proxy(Socket frontEnd, Socket backEnd)
Context
public void forward(Socket frontEnd, Socket backEnd)
Context
public Socket fork(Backgroundable backgroundable)
Context
public void fork(Socket socket, Backgroundable backgroundable)
Context
Copyright © 2019. All rights reserved.