diff --git a/akka-contrib/src/main/scala/akka/contrib/pattern/ReliableProxy.scala b/akka-contrib/src/main/scala/akka/contrib/pattern/ReliableProxy.scala index f958ac0a80..b9430ea337 100644 --- a/akka-contrib/src/main/scala/akka/contrib/pattern/ReliableProxy.scala +++ b/akka-contrib/src/main/scala/akka/contrib/pattern/ReliableProxy.scala @@ -45,7 +45,7 @@ object ReliableProxy { case class Ack(serial: Int) case object Tick - def receiver(target: ActorRef): Props = Props(new Receiver(target)) + def receiver(target: ActorRef): Props = Props(classOf[Receiver], target) sealed trait State case object Idle extends State diff --git a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala index abd55a6e68..9020794c06 100644 --- a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala +++ b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala @@ -71,7 +71,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod system.actorSelection(node(remote) / "user" / "echo") ! Identify("echo") target = expectMsgType[ActorIdentity].ref.get - proxy = system.actorOf(Props(new ReliableProxy(target, 100.millis)), "proxy") + proxy = system.actorOf(Props(classOf[ReliableProxy], target, 100.millis), "proxy") //#demo proxy ! FSM.SubscribeTransitionCallBack(testActor) expectState(Idle) diff --git a/akka-contrib/src/test/scala/akka/contrib/mailbox/PeekMailboxSpec.scala b/akka-contrib/src/test/scala/akka/contrib/mailbox/PeekMailboxSpec.scala index e5f6fa9274..c89e963390 100644 --- a/akka-contrib/src/test/scala/akka/contrib/mailbox/PeekMailboxSpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/mailbox/PeekMailboxSpec.scala @@ -44,7 +44,7 @@ class PeekMailboxSpec extends AkkaSpec(""" "A PeekMailbox" must { "retry messages" in { - val a = system.actorOf(Props(new PeekActor(1)).withDispatcher("peek-dispatcher")) + val a = system.actorOf(Props(classOf[PeekActor], 1).withDispatcher("peek-dispatcher")) a ! "hello" expectMsg("hello") EventFilter[RuntimeException]("DONTWANNA", occurrences = 1) intercept { @@ -57,7 +57,7 @@ class PeekMailboxSpec extends AkkaSpec(""" } "put a bound on retries" in { - val a = system.actorOf(Props(new PeekActor(0)).withDispatcher("peek-dispatcher")) + val a = system.actorOf(Props(classOf[PeekActor], 0).withDispatcher("peek-dispatcher")) EventFilter[RuntimeException]("DONTWANNA", occurrences = 3) intercept { a ! "hello" } @@ -69,7 +69,7 @@ class PeekMailboxSpec extends AkkaSpec(""" } "not waste messages on double-ack()" in { - val a = system.actorOf(Props(new PeekActor(0)).withDispatcher("peek-dispatcher")) + val a = system.actorOf(Props(classOf[PeekActor], 0).withDispatcher("peek-dispatcher")) a ! DoubleAck a ! Check expectMsg(Check) @@ -77,7 +77,7 @@ class PeekMailboxSpec extends AkkaSpec(""" "support cleanup" in { system.eventStream.subscribe(testActor, classOf[DeadLetter]) - val a = system.actorOf(Props(new PeekActor(0)).withDispatcher("peek-dispatcher")) + val a = system.actorOf(Props(classOf[PeekActor], 0).withDispatcher("peek-dispatcher")) watch(a) EventFilter[RuntimeException]("DONTWANNA", occurrences = 1) intercept { a ! "DIE" // stays in the mailbox diff --git a/akka-contrib/src/test/scala/akka/contrib/pattern/ReliableProxyDocSpec.scala b/akka-contrib/src/test/scala/akka/contrib/pattern/ReliableProxyDocSpec.scala index 7e3809123b..6e442114c3 100644 --- a/akka-contrib/src/test/scala/akka/contrib/pattern/ReliableProxyDocSpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/pattern/ReliableProxyDocSpec.scala @@ -20,7 +20,7 @@ class ReliableProxyDocSpec extends AkkaSpec with ImplicitSender { val target = system.deadLetters val a = system.actorOf(Props(new Actor { //#demo-transition - val proxy = context.actorOf(Props(new ReliableProxy(target, 100.millis))) + val proxy = context.actorOf(Props(classOf[ReliableProxy], target, 100.millis)) proxy ! FSM.SubscribeTransitionCallBack(self) var client: ActorRef = _ diff --git a/akka-contrib/src/test/scala/akka/contrib/throttle/TimerBasedThrottlerSpec.scala b/akka-contrib/src/test/scala/akka/contrib/throttle/TimerBasedThrottlerSpec.scala index 52953b9570..7466833f43 100644 --- a/akka-contrib/src/test/scala/akka/contrib/throttle/TimerBasedThrottlerSpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/throttle/TimerBasedThrottlerSpec.scala @@ -46,8 +46,8 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp } })) // The throttler for this example, setting the rate - val throttler = system.actorOf(Props(new TimerBasedThrottler( - 3 msgsPer (1.second.dilated)))) + val throttler = system.actorOf(Props(classOf[TimerBasedThrottler], + 3 msgsPer (1.second.dilated))) // Set the target throttler ! SetTarget(Some(printer)) // These three messages will be sent to the echoer immediately @@ -62,7 +62,7 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp "keep messages until a target is set" in { val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) - val throttler = system.actorOf(Props(new TimerBasedThrottler(3 msgsPer (1.second.dilated)))) + val throttler = system.actorOf(Props(classOf[TimerBasedThrottler], 3 msgsPer (1.second.dilated))) 1 to 6 foreach { throttler ! _ } expectNoMsg(1 second) throttler ! SetTarget(Some(echo)) @@ -73,7 +73,7 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp "send messages after a `SetTarget(None)` pause" in { val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) - val throttler = system.actorOf(Props(new TimerBasedThrottler(3 msgsPer (1.second.dilated)))) + val throttler = system.actorOf(Props(classOf[TimerBasedThrottler], 3 msgsPer (1.second.dilated))) throttler ! SetTarget(Some(echo)) 1 to 3 foreach { throttler ! _ } throttler ! SetTarget(None) @@ -91,7 +91,7 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp "keep messages when the target is set to None" in { val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) - val throttler = system.actorOf(Props(new TimerBasedThrottler(3 msgsPer (1.second.dilated)))) + val throttler = system.actorOf(Props(classOf[TimerBasedThrottler], 3 msgsPer (1.second.dilated))) throttler ! SetTarget(Some(echo)) 1 to 7 foreach { throttler ! _ } throttler ! SetTarget(None) @@ -108,7 +108,7 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp "respect the rate (3 msg/s)" in within(1.5 seconds, 2.5 seconds) { val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) - val throttler = system.actorOf(Props(new TimerBasedThrottler(3 msgsPer (1.second.dilated)))) + val throttler = system.actorOf(Props(classOf[TimerBasedThrottler], 3 msgsPer (1.second.dilated))) throttler ! SetTarget(Some(echo)) 1 to 7 foreach { throttler ! _ } 1 to 7 foreach { expectMsg(_) } @@ -116,7 +116,7 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp "respect the rate (4 msg/s)" in within(1.5 seconds, 2.5 seconds) { val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) - val throttler = system.actorOf(Props(new TimerBasedThrottler(4 msgsPer (1.second.dilated)))) + val throttler = system.actorOf(Props(classOf[TimerBasedThrottler], 4 msgsPer (1.second.dilated))) throttler ! SetTarget(Some(echo)) 1 to 9 foreach { throttler ! _ } 1 to 9 foreach { expectMsg(_) }