Package co.paralleluniverse.actors
Class LocalActor
- java.lang.Object
-
- co.paralleluniverse.actors.LocalActor
-
public final class LocalActor extends java.lang.ObjectStatic methods that provide access toActor's functionality through anActorRefif the actor is local. With the exception of theself()method, application code shouldn't normally use these methods. They are provided mainly for testing, and defining sophisticated behaviors.These services are provided as static methods rather than return a reference to the actor, as references to the actor should not leak outside the actor itself.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringactorToString(ActorRef<?> actor)static <V> Vget(ActorRef<?> actor)static <V> Vget(ActorRef<?> actor, long timeout, java.util.concurrent.TimeUnit unit)static java.lang.Class<? extends Actor>getClass(ActorRef<?> actor)static java.lang.ThrowablegetDeathCause(ActorRef<?> actor)static QueueChannel<java.lang.Object>getMailbox(ActorRef<?> actor)static co.paralleluniverse.actors.ActorMonitorgetMonitor(ActorRef<?> actor)static intgetQueueLength(ActorRef<?> actor)static StrandgetStrand(ActorRef<?> actor)static booleanisDone(ActorRef<?> actor)static booleanisInstance(ActorRef<?> actor, java.lang.Class<? extends Actor> type)static booleanisLocal(ActorRef<?> actor)static voidjoin(ActorRef<?> actor)static voidjoin(ActorRef<?> actor, long timeout, java.util.concurrent.TimeUnit unit)static voidlink(ActorRef<?> actor1, ActorRef<?> actor2)static voidregister(ActorRef<?> actor)static voidregister(ActorRef<?> actor, java.lang.String name)static <T extends ActorRef<M>,M>
Tself()Returns theActorRefof the actor currently running in the current strand.static voidstopMonitor(ActorRef<?> actor)static <M,V>
ActorBuilder<M,V>toActorBuilder(ActorRef<M> actor)static voidunlink(ActorRef<?> actor1, ActorRef<?> actor2)static voidunregister(ActorRef<?> actor)
-
-
-
Method Detail
-
self
public static <T extends ActorRef<M>,M> T self()
Returns theActorRefof the actor currently running in the current strand.- Type Parameters:
T-M-- Returns:
- The
ActorRefof the current actor (caller of this method)
-
isLocal
public static boolean isLocal(ActorRef<?> actor)
-
join
@Suspendable public static void join(ActorRef<?> actor) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
- Throws:
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedException
-
join
@Suspendable public static void join(ActorRef<?> actor, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException
- Throws:
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
get
@Suspendable public static <V> V get(ActorRef<?> actor) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
- Throws:
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedException
-
get
@Suspendable public static <V> V get(ActorRef<?> actor, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException
- Throws:
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
getMailbox
public static QueueChannel<java.lang.Object> getMailbox(ActorRef<?> actor)
-
isDone
public static boolean isDone(ActorRef<?> actor)
-
getDeathCause
public static java.lang.Throwable getDeathCause(ActorRef<?> actor)
-
getMonitor
public static co.paralleluniverse.actors.ActorMonitor getMonitor(ActorRef<?> actor)
-
stopMonitor
public static void stopMonitor(ActorRef<?> actor)
-
register
public static void register(ActorRef<?> actor, java.lang.String name) throws SuspendExecution
- Throws:
SuspendExecution
-
register
public static void register(ActorRef<?> actor) throws SuspendExecution
- Throws:
SuspendExecution
-
unregister
public static void unregister(ActorRef<?> actor)
-
getQueueLength
public static int getQueueLength(ActorRef<?> actor)
-
actorToString
public static java.lang.String actorToString(ActorRef<?> actor)
-
isInstance
public static boolean isInstance(ActorRef<?> actor, java.lang.Class<? extends Actor> type)
-
toActorBuilder
public static <M,V> ActorBuilder<M,V> toActorBuilder(ActorRef<M> actor)
-
-