|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ActorRefFactory
Interface implemented by ActorSystem and ActorContext, the only two places from which you can get fresh actors.
Method Summary | |
---|---|
ActorRef |
actorFor(ActorPath path)
Look-up an actor by path; if it does not exist, returns a reference to the dead-letter mailbox of the ActorSystem . |
ActorRef |
actorFor(scala.collection.Iterable<java.lang.String> path)
Look-up an actor by applying the given path elements, starting from the current context, where ".." signifies the parent of an actor. |
ActorRef |
actorFor(java.lang.Iterable<java.lang.String> path)
Java API: Look-up an actor by applying the given path elements, starting from the current context, where ".." signifies the parent of an actor. |
ActorRef |
actorFor(java.lang.String path)
Look-up an actor by path represented as string. |
ActorRef |
actorOf(Props props)
Create new actor as child of this context and give it an automatically generated name (currently similar to base64-encoded integer count, reversed and with “$” prepended, may change in the future). |
ActorRef |
actorOf(Props props,
java.lang.String name)
Create new actor as child of this context with the given name, which must not be null, empty or start with “$”. |
ActorSelection |
actorSelection(ActorPath path)
Construct an ActorSelection from the given path, which is
parsed for wildcards (these are replaced by regular expressions
internally). |
ActorSelection |
actorSelection(java.lang.String path)
Construct an ActorSelection from the given path, which is
parsed for wildcards (these are replaced by regular expressions
internally). |
scala.concurrent.ExecutionContext |
dispatcher()
Returns the default MessageDispatcher associated with this ActorRefFactory |
akka.actor.InternalActorRef |
guardian()
Father of all children created by this interface. |
akka.actor.InternalActorRef |
lookupRoot()
INTERNAL API |
ActorRefProvider |
provider()
INTERNAL API |
void |
stop(ActorRef actor)
Stop the actor pointed to by the given ActorRef ; this is
an asynchronous operation, i.e. |
akka.actor.ActorSystemImpl |
systemImpl()
INTERNAL API |
Method Detail |
---|
akka.actor.ActorSystemImpl systemImpl()
ActorRefProvider provider()
scala.concurrent.ExecutionContext dispatcher()
akka.actor.InternalActorRef guardian()
INTERNAL API
akka.actor.InternalActorRef lookupRoot()
ActorRef actorOf(Props props)
See Props
for details on how to obtain a Props
object.
ConfigurationException
- if deployment, dispatcher
or mailbox configuration is wrongActorRef actorOf(Props props, java.lang.String name)
InvalidActorNameException
is thrown.
See Props
for details on how to obtain a Props
object.
InvalidActorNameException
- if the given name is
invalid or already in use
ConfigurationException
- if deployment, dispatcher
or mailbox configuration is wrongActorRef actorFor(ActorPath path)
ActorSystem
. If the path
point to an actor which is not local, no attempt is made during this
call to verify that the actor it represents does exist or is alive; use
watch(ref)
to be notified of the target’s termination, which is also
signaled if the queried path cannot be resolved.
ActorRef actorFor(java.lang.String path)
Absolute URIs like akka://appname/user/actorA
are looked up as described
for look-ups by actorOf(ActorPath)
.
Relative URIs like /service/actorA/childB
are looked up relative to the
root path of the ActorSystem
containing this factory and as
described for look-ups by actorOf(Iterable[String])
.
Relative URIs like myChild/grandChild
or ../myBrother
are looked up
relative to the current context as described for look-ups by
actorOf(Iterable[String])
ActorRef actorFor(scala.collection.Iterable<java.lang.String> path)
".."
signifies the parent of an actor.
Example:
class MyActor extends Actor {
def receive = {
case msg =>
...
val target = context.actorFor(Seq("..", "myBrother", "myNephew"))
...
}
}
For maximum performance use a collection with efficient head & tail operations.
ActorRef actorFor(java.lang.Iterable<java.lang.String> path)
".."
signifies the parent of an actor.
Example:
public class MyActor extends UntypedActor {
public void onReceive(Object msg) throws Exception {
...
final List<String> path = new ArrayList<String>();
path.add("..");
path.add("myBrother");
path.add("myNephew");
final ActorRef target = getContext().actorFor(path);
...
}
}
For maximum performance use a collection with efficient head & tail operations.
ActorSelection actorSelection(java.lang.String path)
ActorSelection
from the given path, which is
parsed for wildcards (these are replaced by regular expressions
internally). No attempt is made to verify the existence of any part of
the supplied path, it is recommended to send a message and gather the
replies in order to resolve the matching set of actors.
ActorSelection actorSelection(ActorPath path)
ActorSelection
from the given path, which is
parsed for wildcards (these are replaced by regular expressions
internally). No attempt is made to verify the existence of any part of
the supplied path, it is recommended to send a message and gather the
replies in order to resolve the matching set of actors.
void stop(ActorRef actor)
ActorRef
; this is
an asynchronous operation, i.e. involves a message send.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |