more deprecation warnings removed

This commit is contained in:
dario.rexin 2013-04-26 13:54:10 +02:00
parent 20a819b637
commit 3e8597d94b
7 changed files with 24 additions and 26 deletions

View file

@ -39,8 +39,7 @@ class ActorLifeCycleSpec extends AkkaSpec with BeforeAndAfterEach with ImplicitS
"invoke preRestart, preStart, postRestart when using OneForOneStrategy" in { "invoke preRestart, preStart, postRestart when using OneForOneStrategy" in {
filterException[ActorKilledException] { filterException[ActorKilledException] {
val id = newUuid.toString val id = newUuid.toString
val supervisor = system.actorOf(Props(new Supervisor( val supervisor = system.actorOf(Props(classOf[Supervisor], OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception]))))
OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception])))))
val gen = new AtomicInteger(0) val gen = new AtomicInteger(0)
val restarterProps = Props(new LifeCycleTestActor(testActor, id, gen) { val restarterProps = Props(new LifeCycleTestActor(testActor, id, gen) {
override def preRestart(reason: Throwable, message: Option[Any]) { report("preRestart") } 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 { "default for preRestart and postRestart is to call postStop and preStart respectively" in {
filterException[ActorKilledException] { filterException[ActorKilledException] {
val id = newUuid().toString val id = newUuid().toString
val supervisor = system.actorOf(Props(new Supervisor( val supervisor = system.actorOf(Props(classOf[Supervisor], OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception]))))
OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception])))))
val gen = new AtomicInteger(0) 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) val restarter = Await.result((supervisor ? restarterProps).mapTo[ActorRef], timeout.duration)
expectMsg(("preStart", id, 0)) 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 { "not invoke preRestart and postRestart when never restarted using OneForOneStrategy" in {
val id = newUuid().toString val id = newUuid().toString
val supervisor = system.actorOf(Props(new Supervisor( val supervisor = system.actorOf(Props(classOf[Supervisor],
OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception]))))) OneForOneStrategy(maxNrOfRetries = 3)(List(classOf[Exception]))))
val gen = new AtomicInteger(0) 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) val a = Await.result((supervisor ? props).mapTo[ActorRef], timeout.duration)
expectMsg(("preStart", id, 0)) expectMsg(("preStart", id, 0))
a ! "status" a ! "status"

View file

@ -20,7 +20,7 @@ import akka.camel.internal.ActivationProtocol._
*/ */
private[camel] class CamelSupervisor extends Actor with CamelSupport { private[camel] class CamelSupervisor extends Actor with CamelSupport {
private val activationTracker = context.actorOf(Props[ActivationTracker], "activationTracker") 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() { override val supervisorStrategy = OneForOneStrategy() {
case NonFatal(e) 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 { private[camel] class Registry(activationTracker: ActorRef) extends Actor with CamelSupport {
import context.{ stop, parent } import context.{ stop, parent }
private val producerRegistrar = context.actorOf(Props(new ProducerRegistrar(activationTracker)), "producerRegistrar") private val producerRegistrar = context.actorOf(Props(classOf[ProducerRegistrar], activationTracker), "producerRegistrar")
private val consumerRegistrar = context.actorOf(Props(new ConsumerRegistrar(activationTracker)), "consumerRegistrar") private val consumerRegistrar = context.actorOf(Props(classOf[ConsumerRegistrar], activationTracker), "consumerRegistrar")
private var producers = Set[ActorRef]() private var producers = Set[ActorRef]()
private var consumers = Set[ActorRef]() private var consumers = Set[ActorRef]()

View file

@ -39,7 +39,7 @@ class ConcurrentActivationTest extends WordSpec with MustMatchers with NonShared
// future to all the futures of activation and deactivation // future to all the futures of activation and deactivation
val futureRegistrarLists = promiseRegistrarLists.future 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 // create the registrars
ref ! CreateRegistrars(number) ref ! CreateRegistrars(number)
// send a broadcast to all registrars, so that number * number messages are sent // 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 allActivationFutures = allActivationFutures :+ activationListFuture
allDeactivationFutures = allDeactivationFutures :+ deactivationListFuture 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)) promise.success(Future.sequence(allActivationFutures) -> Future.sequence(allDeactivationFutures))

View file

@ -149,7 +149,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension {
// create supervisor for daemons under path "/system/cluster" // create supervisor for daemons under path "/system/cluster"
private val clusterDaemons: ActorRef = { private val clusterDaemons: ActorRef = {
system.asInstanceOf[ActorSystemImpl].systemActorOf(Props(new ClusterDaemon(settings)). system.asInstanceOf[ActorSystemImpl].systemActorOf(Props(classOf[ClusterDaemon], settings).
withDispatcher(UseDispatcher), name = "cluster") withDispatcher(UseDispatcher), name = "cluster")
} }

View file

@ -188,12 +188,12 @@ private[cluster] final class ClusterDaemon(settings: ClusterSettings) extends Ac
def receive = { def receive = {
case msg @ GetClusterCoreRef coreSupervisor forward msg case msg @ GetClusterCoreRef coreSupervisor forward msg
case AddOnMemberUpListener(code) case AddOnMemberUpListener(code)
context.actorOf(Props(new OnMemberUpListener(code))) context.actorOf(Props(classOf[OnMemberUpListener], code))
case PublisherCreated(publisher) case PublisherCreated(publisher)
if (settings.MetricsEnabled) { if (settings.MetricsEnabled) {
// metrics must be started after core/publisher to be able // metrics must be started after core/publisher to be able
// to inject the publisher ref to the ClusterMetricsCollector // 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") 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]. val publisher = context.actorOf(Props[ClusterDomainEventPublisher].
withDispatcher(context.props.dispatcher), name = "publisher") 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")) withDispatcher(context.props.dispatcher), name = "daemon"))
context.parent ! PublisherCreated(publisher) context.parent ! PublisherCreated(publisher)
@ -355,10 +355,10 @@ private[cluster] final class ClusterCoreDaemon(publisher: ActorRef) extends Acto
self ! ClusterUserAction.JoinTo(selfAddress) self ! ClusterUserAction.JoinTo(selfAddress)
None None
} else if (seedNodes.head == selfAddress) { } else if (seedNodes.head == selfAddress) {
Some(context.actorOf(Props(new FirstSeedNodeProcess(seedNodes)). Some(context.actorOf(Props(classOf[FirstSeedNodeProcess], seedNodes).
withDispatcher(UseDispatcher), name = "firstSeedNodeProcess")) withDispatcher(UseDispatcher), name = "firstSeedNodeProcess"))
} else { } else {
Some(context.actorOf(Props(new JoinSeedNodeProcess(seedNodes)). Some(context.actorOf(Props(classOf[JoinSeedNodeProcess], seedNodes).
withDispatcher(UseDispatcher), name = "joinSeedNodeProcess")) withDispatcher(UseDispatcher), name = "joinSeedNodeProcess"))
} }
} }

View file

@ -529,7 +529,7 @@ private[cluster] object StressMultiJvmSpec extends MultiNodeConfig {
val totalActors = ((width * math.pow(width, levels) - 1) / (width - 1)).toInt 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", log.info("Creating [{}] actors in a tree structure of [{}] levels and each actor has [{}] children",
totalActors, levels, width) 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))) tree forward ((idx, SimpleJob(id, payload)))
context.become(treeWorker(tree)) context.become(treeWorker(tree))
} }
@ -687,7 +687,7 @@ abstract class StressSpec
def createResultAggregator(title: String, expectedResults: Int, includeInHistory: Boolean): Unit = { def createResultAggregator(title: String, expectedResults: Int, includeInHistory: Boolean): Unit = {
runOn(roles.head) { 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) name = "result" + step)
if (includeInHistory) aggregator ! ReportTo(Some(clusterResultHistory)) if (includeInHistory) aggregator ! ReportTo(Some(clusterResultHistory))
else aggregator ! ReportTo(None) else aggregator ! ReportTo(None)
@ -935,7 +935,7 @@ abstract class StressSpec
val (masterRoles, otherRoles) = roles.take(nbrUsedRoles).splitAt(3) val (masterRoles, otherRoles) = roles.take(nbrUsedRoles).splitAt(3)
runOn(masterRoles: _*) { runOn(masterRoles: _*) {
reportResult { 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) name = "master-" + myself.name)
m ! Begin m ! Begin
import system.dispatcher import system.dispatcher
@ -1037,7 +1037,7 @@ abstract class StressSpec
"start routers that are running while nodes are joining" taggedAs LongRunningTest in { "start routers that are running while nodes are joining" taggedAs LongRunningTest in {
runOn(roles.take(3): _*) { 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 name = "master-" + myself.name) ! Begin
} }
enterBarrier("after-" + step) enterBarrier("after-" + step)
@ -1114,7 +1114,7 @@ abstract class StressSpec
"start routers that are running while nodes are removed" taggedAs LongRunningTest in { "start routers that are running while nodes are removed" taggedAs LongRunningTest in {
runOn(roles.take(3): _*) { 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 name = "master-" + myself.name) ! Begin
} }
enterBarrier("after-" + step) enterBarrier("after-" + step)

View file

@ -160,7 +160,7 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou
// cluster consists of first and second // cluster consists of first and second
system.actorOf(Props(new SomeActor(LookupRoutee)), "myservice") system.actorOf(Props(classOf[SomeActor], LookupRoutee), "myservice")
enterBarrier("myservice-started") enterBarrier("myservice-started")
runOn(first) { runOn(first) {