diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorLifeCycleSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorLifeCycleSpec.scala index bcfc9fa0e8..79ddb15440 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorLifeCycleSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorLifeCycleSpec.scala @@ -39,8 +39,7 @@ class ActorLifeCycleSpec extends AkkaSpec with BeforeAndAfterEach with ImplicitS "invoke preRestart, preStart, postRestart when using OneForOneStrategy" in { filterException[ActorKilledException] { val id = newUuid.toString - val supervisor = system.actorOf(Props(new Supervisor( - OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception]))))) + val supervisor = system.actorOf(Props(classOf[Supervisor], OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception])))) val gen = new AtomicInteger(0) val restarterProps = Props(new LifeCycleTestActor(testActor, id, gen) { override def preRestart(reason: Throwable, message: Option[Any]) { report("preRestart") } @@ -74,10 +73,9 @@ class ActorLifeCycleSpec extends AkkaSpec with BeforeAndAfterEach with ImplicitS "default for preRestart and postRestart is to call postStop and preStart respectively" in { filterException[ActorKilledException] { val id = newUuid().toString - val supervisor = system.actorOf(Props(new Supervisor( - OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception]))))) + val supervisor = system.actorOf(Props(classOf[Supervisor], OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception])))) val gen = new AtomicInteger(0) - val restarterProps = Props(new LifeCycleTestActor(testActor, id, gen)) + val restarterProps = Props(classOf[LifeCycleTestActor], testActor, id, gen) val restarter = Await.result((supervisor ? restarterProps).mapTo[ActorRef], timeout.duration) expectMsg(("preStart", id, 0)) @@ -105,10 +103,10 @@ class ActorLifeCycleSpec extends AkkaSpec with BeforeAndAfterEach with ImplicitS "not invoke preRestart and postRestart when never restarted using OneForOneStrategy" in { val id = newUuid().toString - val supervisor = system.actorOf(Props(new Supervisor( - OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception]))))) + val supervisor = system.actorOf(Props(classOf[Supervisor], + OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception])))) val gen = new AtomicInteger(0) - val props = Props(new LifeCycleTestActor(testActor, id, gen)) + val props = Props(classOf[LifeCycleTestActor], testActor, id, gen) val a = Await.result((supervisor ? props).mapTo[ActorRef], timeout.duration) expectMsg(("preStart", id, 0)) a ! "status" diff --git a/akka-camel/src/main/scala/akka/camel/internal/CamelSupervisor.scala b/akka-camel/src/main/scala/akka/camel/internal/CamelSupervisor.scala index 72925c78ea..5a5083f07e 100644 --- a/akka-camel/src/main/scala/akka/camel/internal/CamelSupervisor.scala +++ b/akka-camel/src/main/scala/akka/camel/internal/CamelSupervisor.scala @@ -20,7 +20,7 @@ import akka.camel.internal.ActivationProtocol._ */ private[camel] class CamelSupervisor extends Actor with CamelSupport { private val activationTracker = context.actorOf(Props[ActivationTracker], "activationTracker") - private val registry: ActorRef = context.actorOf(Props(new Registry(activationTracker)), "registry") + private val registry: ActorRef = context.actorOf(Props(classOf[Registry], activationTracker), "registry") override val supervisorStrategy = OneForOneStrategy() { case NonFatal(e) ⇒ @@ -90,8 +90,8 @@ private[camel] class ActorActivationException(val actorRef: ActorRef, cause: Thr private[camel] class Registry(activationTracker: ActorRef) extends Actor with CamelSupport { import context.{ stop, parent } - private val producerRegistrar = context.actorOf(Props(new ProducerRegistrar(activationTracker)), "producerRegistrar") - private val consumerRegistrar = context.actorOf(Props(new ConsumerRegistrar(activationTracker)), "consumerRegistrar") + private val producerRegistrar = context.actorOf(Props(classOf[ProducerRegistrar], activationTracker), "producerRegistrar") + private val consumerRegistrar = context.actorOf(Props(classOf[ConsumerRegistrar], activationTracker), "consumerRegistrar") private var producers = Set[ActorRef]() private var consumers = Set[ActorRef]() @@ -199,4 +199,4 @@ private[camel] class ConsumerRegistrar(activationTracker: ActorRef) extends Acto case NonFatal(e) ⇒ throw new ActorDeActivationException(consumer, e) } } -} \ No newline at end of file +} diff --git a/akka-camel/src/test/scala/akka/camel/ConcurrentActivationTest.scala b/akka-camel/src/test/scala/akka/camel/ConcurrentActivationTest.scala index 9bf577a893..148865c388 100644 --- a/akka-camel/src/test/scala/akka/camel/ConcurrentActivationTest.scala +++ b/akka-camel/src/test/scala/akka/camel/ConcurrentActivationTest.scala @@ -39,7 +39,7 @@ class ConcurrentActivationTest extends WordSpec with MustMatchers with NonShared // future to all the futures of activation and deactivation val futureRegistrarLists = promiseRegistrarLists.future - val ref = system.actorOf(Props(new ConsumerBroadcast(promiseRegistrarLists)), name = "broadcaster") + val ref = system.actorOf(Props(classOf[ConsumerBroadcast], promiseRegistrarLists), name = "broadcaster") // create the registrars ref ! CreateRegistrars(number) // send a broadcast to all registrars, so that number * number messages are sent @@ -95,7 +95,7 @@ class ConsumerBroadcast(promise: Promise[(Future[List[List[ActorRef]]], Future[L allActivationFutures = allActivationFutures :+ activationListFuture allDeactivationFutures = allDeactivationFutures :+ deactivationListFuture - context.actorOf(Props(new Registrar(i, number, activationListPromise, deactivationListPromise)), "registrar-" + i) + context.actorOf(Props(classOf[Registrar], i, number, activationListPromise, deactivationListPromise), "registrar-" + i) } promise.success(Future.sequence(allActivationFutures) -> Future.sequence(allDeactivationFutures)) diff --git a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala index 92aa1d92f5..1ca230fdae 100644 --- a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala +++ b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala @@ -149,7 +149,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { // create supervisor for daemons under path "/system/cluster" private val clusterDaemons: ActorRef = { - system.asInstanceOf[ActorSystemImpl].systemActorOf(Props(new ClusterDaemon(settings)). + system.asInstanceOf[ActorSystemImpl].systemActorOf(Props(classOf[ClusterDaemon], settings). withDispatcher(UseDispatcher), name = "cluster") } diff --git a/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala b/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala index 71024dffc8..40d37c3c51 100644 --- a/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala +++ b/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala @@ -188,12 +188,12 @@ private[cluster] final class ClusterDaemon(settings: ClusterSettings) extends Ac def receive = { case msg @ GetClusterCoreRef ⇒ coreSupervisor forward msg case AddOnMemberUpListener(code) ⇒ - context.actorOf(Props(new OnMemberUpListener(code))) + context.actorOf(Props(classOf[OnMemberUpListener], code)) case PublisherCreated(publisher) ⇒ if (settings.MetricsEnabled) { // metrics must be started after core/publisher to be able // to inject the publisher ref to the ClusterMetricsCollector - context.actorOf(Props(new ClusterMetricsCollector(publisher)). + context.actorOf(Props(classOf[ClusterMetricsCollector], publisher). withDispatcher(context.props.dispatcher), name = "metrics") } } @@ -211,7 +211,7 @@ private[cluster] final class ClusterCoreSupervisor extends Actor with ActorLoggi val publisher = context.actorOf(Props[ClusterDomainEventPublisher]. withDispatcher(context.props.dispatcher), name = "publisher") - val coreDaemon = context.watch(context.actorOf(Props(new ClusterCoreDaemon(publisher)). + val coreDaemon = context.watch(context.actorOf(Props(classOf[ClusterCoreDaemon], publisher). withDispatcher(context.props.dispatcher), name = "daemon")) context.parent ! PublisherCreated(publisher) @@ -355,10 +355,10 @@ private[cluster] final class ClusterCoreDaemon(publisher: ActorRef) extends Acto self ! ClusterUserAction.JoinTo(selfAddress) None } else if (seedNodes.head == selfAddress) { - Some(context.actorOf(Props(new FirstSeedNodeProcess(seedNodes)). + Some(context.actorOf(Props(classOf[FirstSeedNodeProcess], seedNodes). withDispatcher(UseDispatcher), name = "firstSeedNodeProcess")) } else { - Some(context.actorOf(Props(new JoinSeedNodeProcess(seedNodes)). + Some(context.actorOf(Props(classOf[JoinSeedNodeProcess], seedNodes). withDispatcher(UseDispatcher), name = "joinSeedNodeProcess")) } } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/StressSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/StressSpec.scala index bcd5595f63..91c840b5a1 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/StressSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/StressSpec.scala @@ -529,7 +529,7 @@ private[cluster] object StressMultiJvmSpec extends MultiNodeConfig { val totalActors = ((width * math.pow(width, levels) - 1) / (width - 1)).toInt log.info("Creating [{}] actors in a tree structure of [{}] levels and each actor has [{}] children", totalActors, levels, width) - val tree = context.actorOf(Props(new TreeNode(levels, width)), "tree") + val tree = context.actorOf(Props(classOf[TreeNode], levels, width), "tree") tree forward ((idx, SimpleJob(id, payload))) context.become(treeWorker(tree)) } @@ -687,7 +687,7 @@ abstract class StressSpec def createResultAggregator(title: String, expectedResults: Int, includeInHistory: Boolean): Unit = { runOn(roles.head) { - val aggregator = system.actorOf(Props(new ClusterResultAggregator(title, expectedResults, settings)), + val aggregator = system.actorOf(Props(classOf[ClusterResultAggregator], title, expectedResults, settings), name = "result" + step) if (includeInHistory) aggregator ! ReportTo(Some(clusterResultHistory)) else aggregator ! ReportTo(None) @@ -935,7 +935,7 @@ abstract class StressSpec val (masterRoles, otherRoles) = roles.take(nbrUsedRoles).splitAt(3) runOn(masterRoles: _*) { reportResult { - val m = system.actorOf(Props(new Master(settings, batchInterval, tree)), + val m = system.actorOf(Props(classOf[Master], settings, batchInterval, tree), name = "master-" + myself.name) m ! Begin import system.dispatcher @@ -1037,7 +1037,7 @@ abstract class StressSpec "start routers that are running while nodes are joining" taggedAs LongRunningTest in { runOn(roles.take(3): _*) { - system.actorOf(Props(new Master(settings, settings.workBatchInterval, tree = false)), + system.actorOf(Props(classOf[Master], settings, settings.workBatchInterval, false), name = "master-" + myself.name) ! Begin } enterBarrier("after-" + step) @@ -1114,7 +1114,7 @@ abstract class StressSpec "start routers that are running while nodes are removed" taggedAs LongRunningTest in { runOn(roles.take(3): _*) { - system.actorOf(Props(new Master(settings, settings.workBatchInterval, tree = false)), + system.actorOf(Props(classOf[Master], settings, settings.workBatchInterval, false), name = "master-" + myself.name) ! Begin } enterBarrier("after-" + step) diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterRoundRobinRoutedActorSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterRoundRobinRoutedActorSpec.scala index 9cfd120a0e..ecd6428420 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterRoundRobinRoutedActorSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterRoundRobinRoutedActorSpec.scala @@ -160,7 +160,7 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou // cluster consists of first and second - system.actorOf(Props(new SomeActor(LookupRoutee)), "myservice") + system.actorOf(Props(classOf[SomeActor], LookupRoutee), "myservice") enterBarrier("myservice-started") runOn(first) {