|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjuglr.Actor
juglr.MulticastActor
public class MulticastActor
Asynchronously forward incoming messages to a collection of delegates
based on a given strategy. For cases where you want to forward messages
to a single actor out of a given set see DelegatingActor
.
DelegatingActor
Nested Class Summary | |
---|---|
static interface |
MulticastActor.Strategy
Used by MulticastActor to determine which addresses
to relay a given message to |
Field Summary | |
---|---|
protected MulticastActor.Strategy |
strategy
|
Constructor Summary | |
---|---|
MulticastActor(Actor... delegates)
|
|
MulticastActor(Address... delegates)
Create a new multicast actor forwarding all incoming messages to all members of delegates . |
|
MulticastActor(java.lang.Iterable<Address> delegates)
Create a new multicast actor forwarding all incoming messages to all members of delegates . |
|
MulticastActor(MulticastActor.Strategy strategy)
Create a new multicast actor forwarding all incoming messages to all delegates determined by a given MulticastActor.Strategy . |
Method Summary | |
---|---|
static MulticastActor |
newForActors(Actor... delegates)
|
static MulticastActor |
newForActors(java.lang.Iterable<Actor> delegates)
|
void |
react(Message msg)
Asynchronously send msg to all addresses determined by calling
MulticastActor.Strategy.recipients(juglr.Message) . |
void |
start()
Invoke MulticastActor.Strategy.start() |
boolean |
validate(Message msg)
If this method returns false msg will not be sent
along to the delegates. |
Methods inherited from class juglr.Actor |
---|
await, awaitTimeout, getAddress, getBus, send, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected MulticastActor.Strategy strategy
Constructor Detail |
---|
public MulticastActor(Address... delegates)
delegates
.
delegates
- the collection of delegates to forward all messages topublic MulticastActor(java.lang.Iterable<Address> delegates)
delegates
.
delegates
- the collection of delegates to forward all messages topublic MulticastActor(MulticastActor.Strategy strategy)
MulticastActor.Strategy
.
strategy
- the MulticastActor.Strategy
used to determine the message
recipientspublic MulticastActor(Actor... delegates)
Method Detail |
---|
public static MulticastActor newForActors(java.lang.Iterable<Actor> delegates)
public static MulticastActor newForActors(Actor... delegates)
public void react(Message msg)
msg
to all addresses determined by calling
MulticastActor.Strategy.recipients(juglr.Message)
.
react
in class Actor
msg
- the incoming messagepublic void start()
MulticastActor.Strategy.start()
start
in class Actor
public boolean validate(Message msg)
false
msg
will not be sent
along to the delegates. The default implementation always return
true
- subclasses should override this method with their own
validation logic.
msg
- the message to validate
true
if the message is good and should be forwarded to
the delegates and false
if the message should be blocked
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |