Merge branch 'master' into wip-2006-binary-compat-√
This commit is contained in:
commit
3ba5db053a
30 changed files with 4059 additions and 515 deletions
|
|
@ -138,7 +138,7 @@ case class Props(
|
|||
* Java API.
|
||||
*/
|
||||
def this(actorClass: Class[_ <: Actor]) = this(
|
||||
creator = () ⇒ actorClass.newInstance,
|
||||
creator = FromClassCreator(actorClass),
|
||||
dispatcher = Dispatchers.DefaultDispatcherId,
|
||||
routerConfig = Props.defaultRoutedProps)
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ case class Props(
|
|||
*
|
||||
* Java API.
|
||||
*/
|
||||
def withCreator(c: Class[_ <: Actor]): Props = copy(creator = () ⇒ c.newInstance)
|
||||
def withCreator(c: Class[_ <: Actor]): Props = copy(creator = FromClassCreator(c))
|
||||
|
||||
/**
|
||||
* Returns a new Props with the specified dispatcher set.
|
||||
|
|
@ -177,4 +177,13 @@ case class Props(
|
|||
* Returns a new Props with the specified deployment configuration.
|
||||
*/
|
||||
def withDeploy(d: Deploy): Props = copy(deploy = d)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when creating an Actor from a class. Special Function0 to be
|
||||
* able to optimize serialization.
|
||||
*/
|
||||
private[akka] case class FromClassCreator(clazz: Class[_ <: Actor]) extends Function0[Actor] {
|
||||
def apply(): Actor = clazz.newInstance
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue