More props factories, see #3418
This commit is contained in:
parent
51ed174432
commit
1dac00a129
3 changed files with 5 additions and 5 deletions
|
|
@ -59,7 +59,7 @@ class DemoActorWrapper extends Actor {
|
|||
* @return a Props for creating this actor, which can then be further configured
|
||||
* (e.g. calling `.withDispatcher()` on it)
|
||||
*/
|
||||
def apply(name: String): Props = Props(classOf[DemoActor], name)
|
||||
def props(name: String): Props = Props(classOf[DemoActor], name)
|
||||
}
|
||||
|
||||
class DemoActor(name: String) extends Actor {
|
||||
|
|
@ -70,7 +70,7 @@ class DemoActorWrapper extends Actor {
|
|||
|
||||
// ...
|
||||
|
||||
context.actorOf(DemoActor("hello"))
|
||||
context.actorOf(DemoActor.props("hello"))
|
||||
//#props-factory
|
||||
|
||||
def receive = Actor.emptyBehavior
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class EchoManager(handlerClass: Class[_]) extends Actor with ActorLogging {
|
|||
}
|
||||
|
||||
object EchoHandler {
|
||||
def apply(connection: ActorRef, remote: InetSocketAddress): Props =
|
||||
def props(connection: ActorRef, remote: InetSocketAddress): Props =
|
||||
Props(classOf[EchoHandler], connection, remote)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class SimplisticHandler extends Actor {
|
|||
|
||||
//#client
|
||||
object Client {
|
||||
def apply(remote: InetSocketAddress, replies: ActorRef) =
|
||||
def props(remote: InetSocketAddress, replies: ActorRef) =
|
||||
Props(classOf[Client], remote, replies)
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ class IODocSpec extends AkkaSpec {
|
|||
"demonstrate connect" in {
|
||||
val server = system.actorOf(Props(classOf[Parent], this), "parent")
|
||||
val listen = expectMsgType[Tcp.Bound].localAddress
|
||||
val client = system.actorOf(Client(listen, testActor), "client1")
|
||||
val client = system.actorOf(Client.props(listen, testActor), "client1")
|
||||
|
||||
val c1, c2 = expectMsgType[Tcp.Connected]
|
||||
c1.localAddress must be(c2.remoteAddress)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue