Making sure that TypedActor use the same instantiation strategy as FromClassCreator
This commit is contained in:
parent
32dc65aab5
commit
5f335cb8c8
3 changed files with 27 additions and 10 deletions
|
|
@ -10,6 +10,7 @@ import akka.dispatch._
|
|||
import akka.japi.Creator
|
||||
import scala.reflect.ClassTag
|
||||
import akka.routing._
|
||||
import akka.util.Reflect
|
||||
|
||||
/**
|
||||
* Factory for Props instances.
|
||||
|
|
@ -188,10 +189,5 @@ case class Props(
|
|||
* able to optimize serialization.
|
||||
*/
|
||||
private[akka] case class FromClassCreator(clazz: Class[_ <: Actor]) extends Function0[Actor] {
|
||||
def apply(): Actor = try clazz.newInstance catch {
|
||||
case iae: IllegalAccessException ⇒
|
||||
val ctor = clazz.getDeclaredConstructor()
|
||||
ctor.setAccessible(true)
|
||||
ctor.newInstance()
|
||||
}
|
||||
def apply(): Actor = Reflect.instantiate(clazz)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue