Package org.zeromq
Class ZProxy.ProxyActor
- java.lang.Object
-
- org.zeromq.ZActor.SimpleActor
-
- org.zeromq.ZProxy.ProxyActor
-
- All Implemented Interfaces:
ZActor.Actor
- Enclosing class:
- ZProxy
private static final class ZProxy.ProxyActor extends ZActor.SimpleActor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ZProxy.ProxyActor.State
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object[]
args
private ZMQ.Socket
backend
private ZMQ.Socket
capture
private ZMQ.Socket
frontend
private java.lang.String
name
private ZProxy.Proxy
provider
private ZProxy.ProxyActor.State
state
private ZProxy.Pump
transport
-
Constructor Summary
Constructors Constructor Description ProxyActor(java.lang.String name, ZProxy.Pump transport, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
backstage(ZMQ.Socket pipe, ZPoller poller, int events)
Called when the actor received a control message from its pipe during a loop.java.util.List<ZMQ.Socket>
createSockets(ZContext ctx, java.lang.Object... args)
Creates and initializes sockets for the double.boolean
destroyed(ZContext ctx, ZMQ.Socket pipe, ZPoller poller)
Called when the current double has been destroyed.boolean
looped(ZMQ.Socket pipe, ZPoller poller)
Called at the end of each loop.long
looping(ZMQ.Socket pipe, ZPoller poller)
Called every time just before a loop starts.private boolean
pause(ZPoller poller, boolean pause)
java.lang.String
premiere(ZMQ.Socket pipe)
This is the grand premiere! Called before the creation of the first double and the sockets 2nd in the order call of the global acting.private boolean
restart(ZMQ.Socket pipe, boolean hot)
boolean
stage(ZMQ.Socket socket, ZMQ.Socket pipe, ZPoller poller, int events)
The actor received a message from the created sockets during a loop.void
start(ZMQ.Socket pipe, java.util.List<ZMQ.Socket> sockets, ZPoller poller)
Called when the double is started, before the first loop.private boolean
start(ZPoller poller)
private ZMsg
status()
private boolean
stop()
-
Methods inherited from class org.zeromq.ZActor.SimpleActor
closed, finished
-
-
-
-
Field Detail
-
state
private final ZProxy.ProxyActor.State state
-
transport
private final ZProxy.Pump transport
-
name
private final java.lang.String name
-
provider
private ZProxy.Proxy provider
-
args
private java.lang.Object[] args
-
frontend
private ZMQ.Socket frontend
-
backend
private ZMQ.Socket backend
-
capture
private ZMQ.Socket capture
-
-
Constructor Detail
-
ProxyActor
public ProxyActor(java.lang.String name, ZProxy.Pump transport, int id)
-
-
Method Detail
-
premiere
public java.lang.String premiere(ZMQ.Socket pipe)
Description copied from interface:ZActor.Actor
This is the grand premiere! Called before the creation of the first double and the sockets 2nd in the order call of the global acting. It return the name that will be used for the thread. If it's null, a default one will be picked by ZActor.- Specified by:
premiere
in interfaceZActor.Actor
- Overrides:
premiere
in classZActor.SimpleActor
- Parameters:
pipe
- the backstage control pipe- Returns:
- the name of the upcoming performance.
-
createSockets
public java.util.List<ZMQ.Socket> createSockets(ZContext ctx, java.lang.Object... args)
Description copied from interface:ZActor.Actor
Creates and initializes sockets for the double. This is done at each creation of a new double. 3rd in the order call of the global acting. 1st in the order call of the new double.- Specified by:
createSockets
in interfaceZActor.Actor
- Overrides:
createSockets
in classZActor.SimpleActor
- Parameters:
ctx
- the context used to create socketsargs
- the arguments passed as parameters of the ZActor- Returns:
- a list of created sockets that will be managed by the double. Not null.
-
start
public void start(ZMQ.Socket pipe, java.util.List<ZMQ.Socket> sockets, ZPoller poller)
Description copied from interface:ZActor.Actor
Called when the double is started, before the first loop. 4th in the order call of the global acting. 2nd in the order call of the new double.- Specified by:
start
in interfaceZActor.Actor
- Overrides:
start
in classZActor.SimpleActor
- Parameters:
pipe
- the backstage control pipesockets
- the managed sockets that were created in the previous steppoller
- the poller where to eventually register the sockets for events
-
backstage
public boolean backstage(ZMQ.Socket pipe, ZPoller poller, int events)
Description copied from interface:ZActor.Actor
Called when the actor received a control message from its pipe during a loop. 2nd in the order call of the new loop.- Specified by:
backstage
in interfaceZActor.Actor
- Overrides:
backstage
in classZActor.SimpleActor
- Parameters:
pipe
- the backstage control pipe receiving the messagepoller
- the poller of the double.events
- the events source of the call- Returns:
- true in case of success, false to stop the actor.
-
status
private ZMsg status()
-
start
private boolean start(ZPoller poller)
-
pause
private boolean pause(ZPoller poller, boolean pause)
-
stop
private boolean stop()
-
restart
private boolean restart(ZMQ.Socket pipe, boolean hot)
-
looping
public long looping(ZMQ.Socket pipe, ZPoller poller)
Description copied from interface:ZActor.Actor
Called every time just before a loop starts. 5th in the order call of the global acting. 3nd in the order call of the new double. 1st in the order call of the new loop.- Specified by:
looping
in interfaceZActor.Actor
- Overrides:
looping
in classZActor.SimpleActor
- Parameters:
pipe
- the backstage control pipepoller
- the poller of the double- Returns:
- the timeout of the coming loop. -1 to block, 0 to not wait, > 0 to wait till max the returned duration in milliseconds
-
stage
public boolean stage(ZMQ.Socket socket, ZMQ.Socket pipe, ZPoller poller, int events)
Description copied from interface:ZActor.Actor
The actor received a message from the created sockets during a loop. 2nd ex-aequo in the order call of the new loop.- Specified by:
stage
in interfaceZActor.Actor
- Overrides:
stage
in classZActor.SimpleActor
- Parameters:
socket
- the socket receiving the messagepipe
- the backstage control pipepoller
- the poller of the double.events
- the events source of the call- Returns:
- true in case of success, false to stop the actor.
-
looped
public boolean looped(ZMQ.Socket pipe, ZPoller poller)
Description copied from interface:ZActor.Actor
Called at the end of each loop. 3rd in the order call of the new loop.- Specified by:
looped
in interfaceZActor.Actor
- Overrides:
looped
in classZActor.SimpleActor
- Parameters:
pipe
- the backstage control pipepoller
- the poller of the double.- Returns:
- true to continue with the current doppelganger, false to stop it.
-
destroyed
public boolean destroyed(ZContext ctx, ZMQ.Socket pipe, ZPoller poller)
Description copied from interface:ZActor.Actor
Called when the current double has been destroyed. Last in the order call of the double.- Specified by:
destroyed
in interfaceZActor.Actor
- Overrides:
destroyed
in classZActor.SimpleActor
- Parameters:
ctx
- the context.pipe
- the backstage control pipe.poller
- the poller of the double.- Returns:
- true to restart a new double, false to stop the acting process
-
-