removed some deprecation warnings from akka-contrib

This commit is contained in:
Dario Rexin 2013-04-26 20:44:07 +02:00
parent 3e8597d94b
commit 3ffabf00ec
5 changed files with 14 additions and 14 deletions

View file

@ -45,7 +45,7 @@ object ReliableProxy {
case class Ack(serial: Int) case class Ack(serial: Int)
case object Tick case object Tick
def receiver(target: ActorRef): Props = Props(new Receiver(target)) def receiver(target: ActorRef): Props = Props(classOf[Receiver], target)
sealed trait State sealed trait State
case object Idle extends State case object Idle extends State

View file

@ -71,7 +71,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod
system.actorSelection(node(remote) / "user" / "echo") ! Identify("echo") system.actorSelection(node(remote) / "user" / "echo") ! Identify("echo")
target = expectMsgType[ActorIdentity].ref.get 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 //#demo
proxy ! FSM.SubscribeTransitionCallBack(testActor) proxy ! FSM.SubscribeTransitionCallBack(testActor)
expectState(Idle) expectState(Idle)

View file

@ -44,7 +44,7 @@ class PeekMailboxSpec extends AkkaSpec("""
"A PeekMailbox" must { "A PeekMailbox" must {
"retry messages" in { "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" a ! "hello"
expectMsg("hello") expectMsg("hello")
EventFilter[RuntimeException]("DONTWANNA", occurrences = 1) intercept { EventFilter[RuntimeException]("DONTWANNA", occurrences = 1) intercept {
@ -57,7 +57,7 @@ class PeekMailboxSpec extends AkkaSpec("""
} }
"put a bound on retries" in { "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 { EventFilter[RuntimeException]("DONTWANNA", occurrences = 3) intercept {
a ! "hello" a ! "hello"
} }
@ -69,7 +69,7 @@ class PeekMailboxSpec extends AkkaSpec("""
} }
"not waste messages on double-ack()" in { "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 ! DoubleAck
a ! Check a ! Check
expectMsg(Check) expectMsg(Check)
@ -77,7 +77,7 @@ class PeekMailboxSpec extends AkkaSpec("""
"support cleanup" in { "support cleanup" in {
system.eventStream.subscribe(testActor, classOf[DeadLetter]) 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) watch(a)
EventFilter[RuntimeException]("DONTWANNA", occurrences = 1) intercept { EventFilter[RuntimeException]("DONTWANNA", occurrences = 1) intercept {
a ! "DIE" // stays in the mailbox a ! "DIE" // stays in the mailbox

View file

@ -20,7 +20,7 @@ class ReliableProxyDocSpec extends AkkaSpec with ImplicitSender {
val target = system.deadLetters val target = system.deadLetters
val a = system.actorOf(Props(new Actor { val a = system.actorOf(Props(new Actor {
//#demo-transition //#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) proxy ! FSM.SubscribeTransitionCallBack(self)
var client: ActorRef = _ var client: ActorRef = _

View file

@ -46,8 +46,8 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp
} }
})) }))
// The throttler for this example, setting the rate // The throttler for this example, setting the rate
val throttler = system.actorOf(Props(new TimerBasedThrottler( val throttler = system.actorOf(Props(classOf[TimerBasedThrottler],
3 msgsPer (1.second.dilated)))) 3 msgsPer (1.second.dilated)))
// Set the target // Set the target
throttler ! SetTarget(Some(printer)) throttler ! SetTarget(Some(printer))
// These three messages will be sent to the echoer immediately // 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 { "keep messages until a target is set" in {
val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) 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 ! _ } 1 to 6 foreach { throttler ! _ }
expectNoMsg(1 second) expectNoMsg(1 second)
throttler ! SetTarget(Some(echo)) throttler ! SetTarget(Some(echo))
@ -73,7 +73,7 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp
"send messages after a `SetTarget(None)` pause" in { "send messages after a `SetTarget(None)` pause" in {
val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) 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)) throttler ! SetTarget(Some(echo))
1 to 3 foreach { throttler ! _ } 1 to 3 foreach { throttler ! _ }
throttler ! SetTarget(None) throttler ! SetTarget(None)
@ -91,7 +91,7 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp
"keep messages when the target is set to None" in { "keep messages when the target is set to None" in {
val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) 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)) throttler ! SetTarget(Some(echo))
1 to 7 foreach { throttler ! _ } 1 to 7 foreach { throttler ! _ }
throttler ! SetTarget(None) 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) { "respect the rate (3 msg/s)" in within(1.5 seconds, 2.5 seconds) {
val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) 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)) throttler ! SetTarget(Some(echo))
1 to 7 foreach { throttler ! _ } 1 to 7 foreach { throttler ! _ }
1 to 7 foreach { expectMsg(_) } 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) { "respect the rate (4 msg/s)" in within(1.5 seconds, 2.5 seconds) {
val echo = system.actorOf(Props[TimerBasedThrottlerSpec.EchoActor]) 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)) throttler ! SetTarget(Some(echo))
1 to 9 foreach { throttler ! _ } 1 to 9 foreach { throttler ! _ }
1 to 9 foreach { expectMsg(_) } 1 to 9 foreach { expectMsg(_) }