Package co.paralleluniverse.actors
Interface MessageProcessor<Message,T>
-
- All Known Implementing Classes:
MessageSelector
public interface MessageProcessor<Message,T>
An interface that is used byBasicActor.receive
for selective receive.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
process(Message m)
An implementation of this method is used to select messages off an actor's queue for the purpose of selective receive.
-
-
-
Method Detail
-
process
T process(Message m) throws SuspendExecution, java.lang.InterruptedException
An implementation of this method is used to select messages off an actor's queue for the purpose of selective receive. If the message is selected (i.e. it should be processed now), then this method should return a non-null value. If the message is to be skipped, this method should returnnull
. The value returned by this method, will be returned by thereceive
method this instance has been passed to.If the message is selected, this method may process it (and may even call
receive
for nested selective receives), or it may choose to return the message and have it processed when it is returned from the enclosingreceive
.- Parameters:
m
- The message- Returns:
- A non-null value if the message is selected;
null
if the message is to be skipped. - Throws:
SuspendExecution
java.lang.InterruptedException
-
-