diff --git a/akka-actor-tests/src/test/scala/akka/actor/actor/ActorTimeoutSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/actor/ActorTimeoutSpec.scala
index b42ac75bcb..a10100497a 100644
--- a/akka-actor-tests/src/test/scala/akka/actor/actor/ActorTimeoutSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/actor/actor/ActorTimeoutSpec.scala
@@ -35,21 +35,10 @@ class ActorTimeoutSpec
}
}
- "use implicitly supplied timeout" in {
- implicit val timeout = Actor.Timeout(testTimeout)
- within(testTimeout - 100.millis, testTimeout + 300.millis) {
- val f = (echo ? "hallo").mapTo[String]
- intercept[FutureTimeoutException] { f.await }
- f.value must be(None)
- }
- }
-
"use explicitly supplied timeout" in {
within(testTimeout - 100.millis, testTimeout + 300.millis) {
- (echo.?("hallo")(timeout = testTimeout)).as[String] must be(None)
+ (echo.?("hallo", testTimeout)).as[String] must be(None)
}
}
-
}
-
}
diff --git a/akka-actor-tests/src/test/scala/akka/actor/supervisor/SupervisorSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/supervisor/SupervisorSpec.scala
index 3fb0908402..8c5f397387 100644
--- a/akka-actor-tests/src/test/scala/akka/actor/supervisor/SupervisorSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/actor/supervisor/SupervisorSpec.scala
@@ -66,7 +66,7 @@ object SupervisorSpec {
}
override def receive = {
- case Die ⇒ (temp.?(Die)(timeout = TimeoutMillis)).get
+ case Die ⇒ (temp.?(Die, TimeoutMillis)).get
}
}
@@ -200,7 +200,7 @@ class SupervisorSpec extends WordSpec with MustMatchers with BeforeAndAfterEach
}
def ping(pingPongActor: ActorRef) = {
- (pingPongActor.?(Ping)(timeout = TimeoutMillis)).as[String].getOrElse("nil") must be === PongMessage
+ (pingPongActor.?(Ping, TimeoutMillis)).as[String].getOrElse("nil") must be === PongMessage
messageLogPoll must be === PingMessage
}
@@ -215,7 +215,7 @@ class SupervisorSpec extends WordSpec with MustMatchers with BeforeAndAfterEach
val master = actorOf[Master].start()
intercept[RuntimeException] {
- (master.?(Die)(timeout = TimeoutMillis)).get
+ (master.?(Die, TimeoutMillis)).get
}
sleepFor(1 second)
@@ -226,7 +226,7 @@ class SupervisorSpec extends WordSpec with MustMatchers with BeforeAndAfterEach
val (temporaryActor, supervisor) = temporaryActorAllForOne
intercept[RuntimeException] {
- (temporaryActor.?(Die)(timeout = TimeoutMillis)).get
+ (temporaryActor.?(Die, TimeoutMillis)).get
}
sleepFor(1 second)
@@ -374,13 +374,13 @@ class SupervisorSpec extends WordSpec with MustMatchers with BeforeAndAfterEach
Supervise(dyingActor, Permanent) :: Nil))
intercept[Exception] {
- (dyingActor.?(Die)(timeout = TimeoutMillis)).get
+ (dyingActor.?(Die, TimeoutMillis)).get
}
// give time for restart
sleepFor(3 seconds)
- (dyingActor.?(Ping)(timeout = TimeoutMillis)).as[String].getOrElse("nil") must be === PongMessage
+ (dyingActor.?(Ping, TimeoutMillis)).as[String].getOrElse("nil") must be === PongMessage
inits.get must be(3)
diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/DispatcherActorSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/DispatcherActorSpec.scala
index 83d6bc21eb..75f984065c 100644
--- a/akka-actor-tests/src/test/scala/akka/dispatch/DispatcherActorSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/dispatch/DispatcherActorSpec.scala
@@ -45,7 +45,7 @@ class DispatcherActorSpec extends JUnitSuite {
@Test
def shouldSendReplySync = {
val actor = actorOf[TestActor].start()
- val result = (actor.?("Hello")(timeout = 10000)).as[String]
+ val result = (actor.?("Hello", 10000)).as[String]
assert("World" === result.get)
actor.stop()
}
diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala
index df829177b9..de81074303 100644
--- a/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala
@@ -180,7 +180,7 @@ class FutureSpec extends JUnitSuite {
}).start()
}
val timeout = 10000
- def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 200))(timeout = timeout).mapTo[Int] }
+ def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 200), timeout).mapTo[Int] }
assert(Futures.fold(0, timeout)(futures)(_ + _).await.result.get === 45)
}
@@ -191,7 +191,7 @@ class FutureSpec extends JUnitSuite {
def receive = { case (add: Int, wait: Int) ⇒ Thread.sleep(wait); self reply_? add }
}).start()
}
- def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 200))(timeout = 10000).mapTo[Int] }
+ def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 200), 10000).mapTo[Int] }
assert(futures.foldLeft(Future(0))((fr, fa) ⇒ for (r ← fr; a ← fa) yield (r + a)).get === 45)
}
@@ -208,7 +208,7 @@ class FutureSpec extends JUnitSuite {
}).start()
}
val timeout = 10000
- def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 100))(timeout = timeout).mapTo[Int] }
+ def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 100), timeout).mapTo[Int] }
assert(Futures.fold(0, timeout)(futures)(_ + _).await.exception.get.getMessage === "shouldFoldResultsWithException: expected")
}
@@ -225,7 +225,7 @@ class FutureSpec extends JUnitSuite {
}).start()
}
val timeout = 10000
- def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 200))(timeout = timeout).mapTo[Int] }
+ def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 200), timeout).mapTo[Int] }
assert(Futures.reduce(futures, timeout)(_ + _).get === 45)
}
@@ -242,7 +242,7 @@ class FutureSpec extends JUnitSuite {
}).start()
}
val timeout = 10000
- def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 100))(timeout = timeout).mapTo[Int] }
+ def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?((idx, idx * 100), timeout).mapTo[Int] }
assert(Futures.reduce(futures, timeout)(_ + _).await.exception.get.getMessage === "shouldFoldResultsWithException: expected")
}
diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/PinnedActorSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/PinnedActorSpec.scala
index 4744e8f451..a3d647fcf3 100644
--- a/akka-actor-tests/src/test/scala/akka/dispatch/PinnedActorSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/dispatch/PinnedActorSpec.scala
@@ -43,7 +43,7 @@ class PinnedActorSpec extends JUnitSuite {
@Test
def shouldSendReplySync = {
val actor = actorOf[TestActor].start()
- val result = (actor.?("Hello")(timeout = 10000)).as[String]
+ val result = (actor.?("Hello", 10000)).as[String]
assert("World" === result.get)
actor.stop()
}
diff --git a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala
index 126eb3ba45..9c1704b7f5 100644
--- a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala
@@ -238,7 +238,7 @@ class RoutingSpec extends WordSpec with MustMatchers {
}).start()
try {
- (for (count ← 1 to 500) yield pool.?("Test")(timeout = 20000)) foreach {
+ (for (count ← 1 to 500) yield pool.?("Test", 20000)) foreach {
_.await.resultOrException.get must be("Response")
}
} finally {
diff --git a/akka-actor-tests/src/test/scala/akka/ticket/Ticket703Spec.scala b/akka-actor-tests/src/test/scala/akka/ticket/Ticket703Spec.scala
index ba2a84196d..b838f33efc 100644
--- a/akka-actor-tests/src/test/scala/akka/ticket/Ticket703Spec.scala
+++ b/akka-actor-tests/src/test/scala/akka/ticket/Ticket703Spec.scala
@@ -28,7 +28,7 @@ class Ticket703Spec extends WordSpec with MustMatchers {
}
})
}).start()
- (actorPool.?("Ping")(timeout = 7000)).await.result must be === Some("Response")
+ (actorPool.?("Ping", 7000)).await.result must be === Some("Response")
}
}
}
diff --git a/akka-actor/src/main/scala/akka/actor/Actor.scala b/akka-actor/src/main/scala/akka/actor/Actor.scala
index 429b686d5b..e4031962c9 100644
--- a/akka-actor/src/main/scala/akka/actor/Actor.scala
+++ b/akka-actor/src/main/scala/akka/actor/Actor.scala
@@ -89,8 +89,11 @@ class InvalidMessageException private[akka] (message: String, cause: Throwable =
/**
* This message is thrown by default when an Actors behavior doesn't match a message
*/
-case class UnhandledMessageException(msg: Any, ref: ActorRef) extends Exception {
- override def getMessage = "Actor %s does not handle [%s]".format(ref, msg)
+case class UnhandledMessageException(msg: Any, ref: ActorRef = null) extends Exception {
+ // constructor with 'null' ActorRef needed to work with client instantiation of remote exception
+ override def getMessage =
+ if (ref ne null) "Actor %s does not handle [%s]".format(ref, msg)
+ else "Actor does not handle [%s]".format(msg)
override def fillInStackTrace() = this //Don't waste cycles generating stack trace
}
diff --git a/akka-actor/src/main/scala/akka/actor/ActorRef.scala b/akka-actor/src/main/scala/akka/actor/ActorRef.scala
index dea6f39018..7694663c95 100644
--- a/akka-actor/src/main/scala/akka/actor/ActorRef.scala
+++ b/akka-actor/src/main/scala/akka/actor/ActorRef.scala
@@ -248,7 +248,8 @@ trait ActorRef extends ActorRefShared with ForwardableChannel with java.lang.Com
* If you are sending messages using ask then you have to use getContext().reply(..)
* to send a reply message to the original sender. If not then the sender will block until the timeout expires.
*/
- def ask(message: AnyRef, timeout: Long, sender: ActorRef): Future[AnyRef] = ?(message)(sender, Actor.Timeout(timeout)).asInstanceOf[Future[AnyRef]]
+ def ask(message: AnyRef, timeout: Long, sender: ActorRef): Future[AnyRef] =
+ ?(message, Actor.Timeout(timeout))(sender).asInstanceOf[Future[AnyRef]]
/**
* Akka Java API.