|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.actor.Props
public class Props
Props is a ActorRef configuration object, that is immutable, so it is thread safe and fully sharable.
Used when creating new actors through; ActorSystem.actorOf
and ActorContext.actorOf
.
In case of providing code which creates the actual Actor instance, that must not return the same instance multiple times.
Examples on Scala API:
val props = Props[MyActor]
val props = Props(new MyActor)
val props = Props(
creator = ..,
dispatcher = ..,
routerConfig = ..
)
val props = Props().withCreator(new MyActor)
val props = Props[MyActor].withRouter(RoundRobinRouter(..))
Examples on Java API:
Props props = new Props();
Props props = new Props(MyActor.class);
Props props = new Props(new UntypedActorFactory() {
public UntypedActor create() {
return new MyActor();
}
});
Props props = new Props().withCreator(new UntypedActorFactory() { ... });
Props props = new Props(MyActor.class).withRouter(new RoundRobinRouter(..));
Constructor Summary | |
---|---|
Props()
No-args constructor that sets all the default values. |
|
Props(java.lang.Class<? extends Actor> actorClass)
Java API: create Props from a given Class |
|
Props(scala.Function0<Actor> creator,
java.lang.String dispatcher,
RouterConfig routerConfig,
Deploy deploy)
|
|
Props(UntypedActorFactory factory)
Java API: create Props from an UntypedActorFactory |
Method Summary | ||
---|---|---|
static Props |
apply(java.lang.Class<? extends Actor> actorClass)
Returns a Props that has default values except for "creator" which will be a function that creates an instance of the supplied class using the default constructor. |
|
static
|
apply(scala.reflect.ClassTag<T> evidence$1)
Returns a Props that has default values except for "creator" which will be a function that creates an instance of the supplied type using the default constructor. |
|
static Props |
apply(Creator<? extends Actor> creator)
Returns a Props that has default values except for "creator" which will be a function that creates an instance using the supplied thunk. |
|
static Props |
apply(scala.Function0<Actor> creator)
Returns a Props that has default values except for "creator" which will be a function that creates an instance using the supplied thunk. |
|
scala.Function0<Actor> |
creator()
|
|
static scala.Function0<Actor> |
defaultCreator()
The defaultCreator, simply throws an UnsupportedOperationException when applied, which is used when creating a Props |
|
static Deploy |
defaultDeploy()
The default Deploy instance which is used when creating a Props |
|
static RouterConfig |
defaultRoutedProps()
The defaultRoutedProps is NoRouter which is used when creating a Props |
|
Deploy |
deploy()
|
|
java.lang.String |
dispatcher()
|
|
static Props |
empty()
A Props instance whose creator will create an actor that doesn't respond to any message |
|
RouterConfig |
routerConfig()
|
|
Props |
withCreator(java.lang.Class<? extends Actor> c)
Java API: Returns a new Props with the specified creator set. |
|
Props |
withCreator(Creator<Actor> c)
Java API: Returns a new Props with the specified creator set. |
|
Props |
withCreator(scala.Function0<Actor> c)
Scala API: Returns a new Props with the specified creator set. |
|
Props |
withDeploy(Deploy d)
Returns a new Props with the specified deployment configuration. |
|
Props |
withDispatcher(java.lang.String d)
Returns a new Props with the specified dispatcher set. |
|
Props |
withRouter(RouterConfig r)
Returns a new Props with the specified router config set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface scala.Product |
---|
productArity, productElement, productIterator, productPrefix |
Methods inherited from interface scala.Equals |
---|
canEqual, equals |
Constructor Detail |
---|
public Props(scala.Function0<Actor> creator, java.lang.String dispatcher, RouterConfig routerConfig, Deploy deploy)
public Props()
public Props(UntypedActorFactory factory)
UntypedActorFactory
public Props(java.lang.Class<? extends Actor> actorClass)
Class
Method Detail |
---|
public static final scala.Function0<Actor> defaultCreator()
public static final RouterConfig defaultRoutedProps()
public static final Deploy defaultDeploy()
public static final Props empty()
public static <T extends Actor> Props apply(scala.reflect.ClassTag<T> evidence$1)
Scala API.
public static Props apply(java.lang.Class<? extends Actor> actorClass)
public static Props apply(scala.Function0<Actor> creator)
Scala API.
public static Props apply(Creator<? extends Actor> creator)
public scala.Function0<Actor> creator()
public java.lang.String dispatcher()
public RouterConfig routerConfig()
public Deploy deploy()
public Props withCreator(scala.Function0<Actor> c)
The creator must not return the same instance multiple times.
public Props withCreator(Creator<Actor> c)
The creator must not return the same instance multiple times.
public Props withCreator(java.lang.Class<? extends Actor> c)
public Props withDispatcher(java.lang.String d)
public Props withRouter(RouterConfig r)
public Props withDeploy(Deploy d)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |