More props factories, see #3418

This commit is contained in:
Patrik Nordwall 2013-05-31 08:09:56 +02:00
parent 51ed174432
commit 1dac00a129
3 changed files with 5 additions and 5 deletions

View file

@ -59,7 +59,7 @@ class DemoActorWrapper extends Actor {
* @return a Props for creating this actor, which can then be further configured * @return a Props for creating this actor, which can then be further configured
* (e.g. calling `.withDispatcher()` on it) * (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 { 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 //#props-factory
def receive = Actor.emptyBehavior def receive = Actor.emptyBehavior

View file

@ -71,7 +71,7 @@ class EchoManager(handlerClass: Class[_]) extends Actor with ActorLogging {
} }
object EchoHandler { object EchoHandler {
def apply(connection: ActorRef, remote: InetSocketAddress): Props = def props(connection: ActorRef, remote: InetSocketAddress): Props =
Props(classOf[EchoHandler], connection, remote) Props(classOf[EchoHandler], connection, remote)
} }

View file

@ -65,7 +65,7 @@ class SimplisticHandler extends Actor {
//#client //#client
object Client { object Client {
def apply(remote: InetSocketAddress, replies: ActorRef) = def props(remote: InetSocketAddress, replies: ActorRef) =
Props(classOf[Client], remote, replies) Props(classOf[Client], remote, replies)
} }
@ -108,7 +108,7 @@ class IODocSpec extends AkkaSpec {
"demonstrate connect" in { "demonstrate connect" in {
val server = system.actorOf(Props(classOf[Parent], this), "parent") val server = system.actorOf(Props(classOf[Parent], this), "parent")
val listen = expectMsgType[Tcp.Bound].localAddress 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] val c1, c2 = expectMsgType[Tcp.Connected]
c1.localAddress must be(c2.remoteAddress) c1.localAddress must be(c2.remoteAddress)