|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectakka.actor.Props
public final class Props
Props is a configuration object using in creating an Actor
; it is
immutable, so it is thread-safe and fully shareable.
Examples on Scala API:
val props = Props.empty
val props = Props[MyActor]
val props = Props(classOf[MyActor], arg1, arg2)
val otherProps = props.withDispatcher("dispatcher-id")
val otherProps = props.withDeploy(<deployment info>)
Examples on Java API:
final Props props = Props.empty();
final Props props = Props.create(MyActor.class, arg1, arg2);
final Props otherProps = props.withDispatcher("dispatcher-id");
final Props otherProps = props.withDeploy(<deployment info>);
Constructor Summary | |
---|---|
Props()
Deprecated. use Props.create(clazz, args ...) instead |
|
Props(java.lang.Class<? extends Actor> actorClass)
Deprecated. use Props.create(clazz) instead; deprecated since it duplicates another API |
|
Props(Deploy deploy,
java.lang.Class<?> clazz,
scala.collection.immutable.Seq<java.lang.Object> args)
|
|
Props(UntypedActorFactory factory)
Deprecated. use Props.create(clazz, args ...) instead; this method has been
deprecated because it encourages creating Props which contain
non-serializable inner classes, making them also
non-serializable |
Method Summary | ||
---|---|---|
java.lang.Class<? extends Actor> |
actorClass()
Obtain an upper-bound approximation of the actor class which is going to be created by these Props. |
|
static Props |
apply(java.lang.Class<?> clazz,
scala.collection.Seq<java.lang.Object> args)
Scala API: create a Props given a class and its constructor arguments. |
|
static
|
apply(scala.reflect.ClassTag<T> evidence$1)
Scala API: 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. |
|
protected static Props |
apply(scala.Function0<Actor> creator)
Scala API: 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,
java.lang.String dispatcher,
RouterConfig routerConfig,
Deploy deploy)
The deprecated legacy constructor. |
|
static
|
apply(scala.Function0<T> creator,
scala.reflect.ClassTag<T> evidence$2)
Scala API: Returns a Props that has default values except for "creator" which will be a function that creates an instance using the supplied thunk. |
|
scala.collection.immutable.Seq<java.lang.Object> |
args()
|
|
java.lang.Object |
clazz()
|
|
static Props |
create(java.lang.Class<?> clazz,
java.lang.Object... args)
Java API: create a Props given a class and its constructor arguments. |
|
static Props |
create(java.lang.Class<?> clazz,
scala.collection.Seq<java.lang.Object> args)
Java API: create a Props given a class and its constructor arguments. |
|
static
|
create(Creator<T> creator)
Create new Props from the given Creator . |
|
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()
Convenience method for extracting the dispatcher information from the contained Deploy instance. |
|
static Props |
empty()
A Props instance whose creator will create an actor that doesn't respond to any message |
|
java.lang.String |
mailbox()
Convenience method for extracting the mailbox information from the contained Deploy instance. |
|
RouterConfig |
routerConfig()
Convenience method for extracting the router configuration from the contained Deploy instance. |
|
static scala.Option<scala.Tuple4<scala.Function0<Actor>,java.lang.String,RouterConfig,Deploy>> |
unapply(Props p,
int dummy)
The deprecated legacy extractor. |
|
Props |
withCreator(java.lang.Class<? extends Actor> c)
Deprecated. use Props.create(clazz) instead; deprecated since it duplicates another API |
|
Props |
withCreator(Creator<Actor> c)
Deprecated. use Props.create(clazz, args ...) instead; this method has been
deprecated because it encourages creating Props which contain
non-serializable inner classes, making them also
non-serializable |
|
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 |
withMailbox(java.lang.String m)
Returns a new Props with the specified mailbox 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(Deploy deploy, java.lang.Class<?> clazz, scala.collection.immutable.Seq<java.lang.Object> args)
public Props()
Props.create(clazz, args ...)
instead
public Props(UntypedActorFactory factory)
Props.create(clazz, args ...)
instead; this method has been
deprecated because it encourages creating Props which contain
non-serializable inner classes, making them also
non-serializable
UntypedActorFactory
public Props(java.lang.Class<? extends Actor> actorClass)
Class
Method Detail |
---|
public static Props create(java.lang.Class<?> clazz, java.lang.Object... args)
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)
protected static Props apply(scala.Function0<Actor> creator)
public static <T extends Actor> Props apply(scala.Function0<T> creator, scala.reflect.ClassTag<T> evidence$2)
CAVEAT: Required mailbox type cannot be detected when using anonymous mixin composition
when creating the instance. For example, the following will not detect the need for
DequeBasedMessageQueueSemantics
as defined in Stash
:
'Props(new Actor with Stash { ... })
Instead you must create a named class that mixin the trait,
e.g. class MyActor extends Actor with Stash
.
public static Props apply(Creator<? extends Actor> creator)
public static Props apply(scala.Function0<Actor> creator, java.lang.String dispatcher, RouterConfig routerConfig, Deploy deploy)
public static scala.Option<scala.Tuple4<scala.Function0<Actor>,java.lang.String,RouterConfig,Deploy>> unapply(Props p, int dummy)
public static Props apply(java.lang.Class<?> clazz, scala.collection.Seq<java.lang.Object> args)
public static Props create(java.lang.Class<?> clazz, scala.collection.Seq<java.lang.Object> args)
public static <T extends Actor> Props create(Creator<T> creator)
Creator
.
public Deploy deploy()
public java.lang.Object clazz()
public scala.collection.immutable.Seq<java.lang.Object> args()
public scala.Function0<Actor> creator()
public java.lang.String dispatcher()
Deploy
instance.
public java.lang.String mailbox()
Deploy
instance.
public RouterConfig routerConfig()
Deploy
instance.
public Props withCreator(scala.Function0<Actor> c)
The creator must not return the same instance multiple times.
public Props withCreator(Creator<Actor> c)
Props.create(clazz, args ...)
instead; this method has been
deprecated because it encourages creating Props which contain
non-serializable inner classes, making them also
non-serializable
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 withMailbox(java.lang.String m)
public Props withRouter(RouterConfig r)
public Props withDeploy(Deploy d)
public java.lang.Class<? extends Actor> actorClass()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |