Package co.paralleluniverse.actors
Class ActorUtil
- java.lang.Object
-
- co.paralleluniverse.actors.ActorUtil
-
public final class ActorUtil extends java.lang.Object
Static utility methods for working with actors.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
randtag()
Generates a random identifier object (with correctequals
andhashCode
semantics) that is unlikely to be equal to any other object generated by this method.static void
sendOrInterrupt(ActorRef<?> actor, java.lang.Object message)
Attempts to send a message to an actor, and if the message cannot be sent due to a full mailbox - interrupt the actor.
-
-
-
Method Detail
-
randtag
public static java.lang.Object randtag()
Generates a random identifier object (with correctequals
andhashCode
semantics) that is unlikely to be equal to any other object generated by this method. This object can be used as a good unique actor message identifier.- Returns:
- a newly allocated random identifier object
-
sendOrInterrupt
public static void sendOrInterrupt(ActorRef<?> actor, java.lang.Object message)
Attempts to send a message to an actor, and if the message cannot be sent due to a full mailbox - interrupt the actor. This is useful for sending a shutdown message to possibly malfunctioning actors.- Parameters:
actor
- the actor to which we send the messagemessage
- the message
-
-