Package org.zeromq
Class ZActor.SimpleActor
java.lang.Object
org.zeromq.ZActor.SimpleActor
- All Implemented Interfaces:
ZActor.Actor
- Direct Known Subclasses:
ZAuth.AuthActor
,ZMonitor.MonitorActor
,ZProxy.ProxyActor
- Enclosing class:
ZActor
Simple adapter for an actor, with no sockets, blocking calls and immediate termination.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
backstage
(ZMQ.Socket pipe, ZPoller poller, int events) Called when the actor received a control message from its pipe during a loop.void
closed
(ZMQ.Socket socket) Called when a created socket has been closed.createSockets
(ZContext ctx, 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
finished
(ZMQ.Socket pipe) Called when the stage is finished.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.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.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, List<ZMQ.Socket> sockets, ZPoller poller) Called when the double is started, before the first loop.
-
Constructor Details
-
SimpleActor
public SimpleActor()
-
-
Method Details
-
premiere
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.- Specified by:
premiere
in interfaceZActor.Actor
- Parameters:
pipe
- the backstage control pipe- Returns:
- the name of the upcoming performance
-
createSockets
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
- 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
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
- 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
-
looping
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
- 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
-
backstage
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
- 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.
-
stage
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
- 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
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
- Parameters:
pipe
- the backstage control pipepoller
- the poller of the double.- Returns:
- true to continue with the current doppelganger, false to stop it.
-
closed
Description copied from interface:ZActor.Actor
Called when a created socket has been closed. The process of destroying the double has already started.- Specified by:
closed
in interfaceZActor.Actor
- Parameters:
socket
- the closed socked.
-
destroyed
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
- 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
-
finished
Description copied from interface:ZActor.Actor
Called when the stage is finished. This is the last call to the actor. Last in the order call of the global acting.- Specified by:
finished
in interfaceZActor.Actor
- Parameters:
pipe
- the backstage control pipe- Returns:
- true to spread the word of the actor's leaving
-