Package co.paralleluniverse.actors
Class LocalActor
- java.lang.Object
-
- co.paralleluniverse.actors.LocalActor
-
public final class LocalActor extends java.lang.Object
Static methods that provide access toActor
's functionality through anActorRef
if 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.String
actorToString(ActorRef<?> actor)
static <V> V
get(ActorRef<?> actor)
static <V> V
get(ActorRef<?> actor, long timeout, java.util.concurrent.TimeUnit unit)
static java.lang.Class<? extends Actor>
getClass(ActorRef<?> actor)
static java.lang.Throwable
getDeathCause(ActorRef<?> actor)
static QueueChannel<java.lang.Object>
getMailbox(ActorRef<?> actor)
static co.paralleluniverse.actors.ActorMonitor
getMonitor(ActorRef<?> actor)
static int
getQueueLength(ActorRef<?> actor)
static Strand
getStrand(ActorRef<?> actor)
static boolean
isDone(ActorRef<?> actor)
static boolean
isInstance(ActorRef<?> actor, java.lang.Class<? extends Actor> type)
static boolean
isLocal(ActorRef<?> actor)
static void
join(ActorRef<?> actor)
static void
join(ActorRef<?> actor, long timeout, java.util.concurrent.TimeUnit unit)
static void
link(ActorRef<?> actor1, ActorRef<?> actor2)
static void
register(ActorRef<?> actor)
static void
register(ActorRef<?> actor, java.lang.String name)
static <T extends ActorRef<M>,M>
Tself()
Returns theActorRef
of the actor currently running in the current strand.static void
stopMonitor(ActorRef<?> actor)
static <M,V>
ActorBuilder<M,V>toActorBuilder(ActorRef<M> actor)
static void
unlink(ActorRef<?> actor1, ActorRef<?> actor2)
static void
unregister(ActorRef<?> actor)
-
-
-
Method Detail
-
self
public static <T extends ActorRef<M>,M> T self()
Returns theActorRef
of the actor currently running in the current strand.- Type Parameters:
T
-M
-- Returns:
- The
ActorRef
of 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.ExecutionException
java.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.ExecutionException
java.lang.InterruptedException
java.util.concurrent.TimeoutException
-
get
@Suspendable public static <V> V get(ActorRef<?> actor) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
- Throws:
java.util.concurrent.ExecutionException
java.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.ExecutionException
java.lang.InterruptedException
java.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)
-
-