diff --git a/akka-actor-tests/src/test/scala/akka/actor/actor/ActorRefSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/actor/ActorRefSpec.scala index 02dfb6ac9b..cd76784249 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/actor/ActorRefSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/actor/ActorRefSpec.scala @@ -310,8 +310,8 @@ class ActorRefSpec extends WordSpec with MustMatchers { } }).start() - val ffive: Future[String] = ref !!! 5 - val fnull: Future[String] = ref !!! null + val ffive: Future[String] = ref ? 5 + val fnull: Future[String] = ref ? null intercept[ActorKilledException] { ref !! PoisonPill diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/ActorModelSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/ActorModelSpec.scala index 07414be0bc..9818b3d0e9 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/ActorModelSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/ActorModelSpec.scala @@ -348,9 +348,9 @@ abstract class ActorModelSpec extends JUnitSuite { implicit val dispatcher = newInterceptedDispatcher val a = newTestActor.start() dispatcher.suspend(a) - val f1: Future[String] = a !!! Reply("foo") - val stopped = a !!! PoisonPill - val shouldBeCompleted = for (i ← 1 to 10) yield a !!! Reply(i) + val f1: Future[String] = a ? Reply("foo") + val stopped = a ? PoisonPill + val shouldBeCompleted = for (i ← 1 to 10) yield a ? Reply(i) dispatcher.resume(a) assert(f1.get === "foo") stopped.await 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 1d18e2c60f..99c4d52313 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala @@ -40,7 +40,7 @@ class FutureSpec extends JUnitSuite { def shouldActorReplyResultThroughExplicitFuture { val actor = actorOf[TestActor] actor.start() - val future = actor !!! "Hello" + val future = actor ? "Hello" future.await assert(future.result.isDefined) assert("World" === future.result.get) @@ -51,7 +51,7 @@ class FutureSpec extends JUnitSuite { def shouldActorReplyExceptionThroughExplicitFuture { val actor = actorOf[TestActor] actor.start() - val future = actor !!! "Failure" + val future = actor ? "Failure" future.await assert(future.exception.isDefined) assert("Expected exception; to test fault-tolerance" === future.exception.get.getMessage) @@ -62,9 +62,9 @@ class FutureSpec extends JUnitSuite { def shouldFutureCompose { val actor1 = actorOf[TestActor].start() val actor2 = actorOf(new Actor { def receive = { case s: String ⇒ self reply s.toUpperCase } }).start() - val future1 = actor1 !!! "Hello" flatMap ((s: String) ⇒ actor2 !!! s) - val future2 = actor1 !!! "Hello" flatMap (actor2 !!! (_: String)) - val future3 = actor1 !!! "Hello" flatMap (actor2 !!! (_: Int)) + val future1 = actor1 ? "Hello" flatMap ((s: String) ⇒ actor2 ? s) + val future2 = actor1 ? "Hello" flatMap (actor2 ? (_: String)) + val future3 = actor1 ? "Hello" flatMap (actor2 ? (_: Int)) assert((future1.get: Any) === "WORLD") assert((future2.get: Any) === "WORLD") intercept[ClassCastException] { future3.get } @@ -76,8 +76,8 @@ class FutureSpec extends JUnitSuite { def shouldFutureComposePatternMatch { val actor1 = actorOf[TestActor].start() val actor2 = actorOf(new Actor { def receive = { case s: String ⇒ self reply s.toUpperCase } }).start() - val future1 = actor1 !!! "Hello" collect { case (s: String) ⇒ s } flatMap (actor2 !!! _) - val future2 = actor1 !!! "Hello" collect { case (n: Int) ⇒ n } flatMap (actor2 !!! _) + val future1 = actor1 ? "Hello" collect { case (s: String) ⇒ s } flatMap (actor2 ? _) + val future2 = actor1 ? "Hello" collect { case (n: Int) ⇒ n } flatMap (actor2 ? _) assert((future1.get: Any) === "WORLD") intercept[MatchError] { future2.get } actor1.stop() @@ -93,18 +93,18 @@ class FutureSpec extends JUnitSuite { } }).start() - val future0 = actor !!! "Hello" + val future0 = actor ? "Hello" val future1 = for { a: Int ← future0 // returns 5 - b: String ← actor !!! a // returns "10" - c: String ← actor !!! 7 // returns "14" + b: String ← actor ? a // returns "10" + c: String ← actor ? 7 // returns "14" } yield b + "-" + c val future2 = for { a: Int ← future0 - b: Int ← actor !!! a - c: String ← actor !!! 7 + b: Int ← actor ? a + c: String ← actor ? 7 } yield b + "-" + c assert(future1.get === "10-14") @@ -124,15 +124,15 @@ class FutureSpec extends JUnitSuite { }).start() val future1 = for { - Res(a: Int) ← actor.!!![Res[Int]](Req("Hello")) - Res(b: String) ← actor.!!![Res[String]](Req(a)) - Res(c: String) ← actor.!!![Res[String]](Req(7)) + Res(a: Int) ← actor.?[Res[Int]](Req("Hello")) + Res(b: String) ← actor.?[Res[String]](Req(a)) + Res(c: String) ← actor.?[Res[String]](Req(7)) } yield b + "-" + c val future2 = for { - Res(a: Int) ← actor.!!) - Res(b: Int) ← actor.!!![Res[Int]](Req(a)) - Res(c: Int) ← actor.!!![Res[Int]](Req(7)) + Res(a: Int) ← actor.?[Any](Req("Hello")) + Res(b: Int) ← actor.?[Res[Int]](Req(a)) + Res(c: Int) ← actor.?[Res[Int]](Req(7)) } yield b + "-" + c assert(future1.get === "10-14") @@ -162,14 +162,14 @@ class FutureSpec extends JUnitSuite { val actor = actorOf[TestActor].start() - val future8 = actor !!! "Failure" - val future9 = actor !!! "Failure" recover { + val future8 = actor ? "Failure" + val future9 = actor ? "Failure" recover { case e: RuntimeException ⇒ "FAIL!" } - val future10 = actor !!! "Hello" recover { + val future10 = actor ? "Hello" recover { case e: RuntimeException ⇒ "FAIL!" } - val future11 = actor !!! "Failure" recover { case _ ⇒ "Oops!" } + val future11 = actor ? "Failure" recover { case _ ⇒ "Oops!" } assert(future1.get === 5) intercept[ArithmeticException] { future2.get } @@ -194,7 +194,7 @@ class FutureSpec extends JUnitSuite { }).start() } val timeout = 10000 - def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.!!, timeout) } + def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?[Int]((idx, idx * 200), timeout) } assert(Futures.fold(0, timeout)(futures)(_ + _).await.result.get === 45) } @@ -205,7 +205,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.!!, 10000) } + def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?[Int]((idx, idx * 200), 10000) } assert(futures.foldLeft(Future(0))((fr, fa) ⇒ for (r ← fr; a ← fa) yield (r + a)).get === 45) } @@ -222,7 +222,7 @@ class FutureSpec extends JUnitSuite { }).start() } val timeout = 10000 - def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.!!, timeout) } + def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?[Int]((idx, idx * 100), timeout) } assert(Futures.fold(0, timeout)(futures)(_ + _).await.exception.get.getMessage === "shouldFoldResultsWithException: expected") } @@ -239,7 +239,7 @@ class FutureSpec extends JUnitSuite { }).start() } val timeout = 10000 - def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.!!, timeout) } + def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?[Int]((idx, idx * 200), timeout) } assert(Futures.reduce(futures, timeout)(_ + _).get === 45) } @@ -256,7 +256,7 @@ class FutureSpec extends JUnitSuite { }).start() } val timeout = 10000 - def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.!!, timeout) } + def futures = actors.zipWithIndex map { case (actor: ActorRef, idx: Int) ⇒ actor.?[Int]((idx, idx * 100), timeout) } assert(Futures.reduce(futures, timeout)(_ + _).await.exception.get.getMessage === "shouldFoldResultsWithException: expected") } @@ -269,7 +269,7 @@ class FutureSpec extends JUnitSuite { def receiveShouldExecuteOnComplete { val latch = new StandardLatch val actor = actorOf[TestActor].start() - actor !!! "Hello" onResult { case "World" ⇒ latch.open } + actor ? "Hello" onResult { case "World" ⇒ latch.open } assert(latch.tryAwait(5, TimeUnit.SECONDS)) actor.stop() } @@ -285,7 +285,7 @@ class FutureSpec extends JUnitSuite { } }).start() - val oddFutures: List[Future[Int]] = List.fill(100)(oddActor !!! 'GetNext) + val oddFutures: List[Future[Int]] = List.fill(100)(oddActor ? 'GetNext) assert(Future.sequence(oddFutures).get.sum === 10000) oddActor.stop() @@ -342,7 +342,7 @@ class FutureSpec extends JUnitSuite { val actor = actorOf[TestActor].start val x = Future("Hello") - val y = x flatMap (actor !!! _) + val y = x flatMap (actor ? _) val r = flow(x() + " " + y[String]() + "!") @@ -370,7 +370,7 @@ class FutureSpec extends JUnitSuite { val actor = actorOf[TestActor].start val x = Future(3) - val y = actor !!! "Hello" + val y = actor ? "Hello" val r = flow(x() + y[Int](), 100) @@ -384,7 +384,7 @@ class FutureSpec extends JUnitSuite { val actor = actorOf[TestActor].start val x = Future("Hello") - val y = actor !!! "Hello" + val y = actor ? "Hello" val r = flow(x() + y()) diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala index 5740edb9b8..84f98f2f75 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala @@ -44,7 +44,7 @@ class PriorityDispatcherSpec extends WordSpec with MustMatchers { dispatcher.resume(actor) //Signal the actor to start treating it's message backlog - actor.!!![List[Int]]('Result).await.result.get must be === (msgs.reverse) + actor.?[List[Int]]('Result).await.result.get must be === (msgs.reverse) } } diff --git a/akka-actor-tests/src/test/scala/akka/misc/ActorRegistrySpec.scala b/akka-actor-tests/src/test/scala/akka/misc/ActorRegistrySpec.scala index df6184c292..b538b5d4ed 100644 --- a/akka-actor-tests/src/test/scala/akka/misc/ActorRegistrySpec.scala +++ b/akka-actor-tests/src/test/scala/akka/misc/ActorRegistrySpec.scala @@ -89,7 +89,7 @@ class ActorRegistrySpec extends JUnitSuite { val actor2 = actorOf[TestActor]("test-actor-2").start val results = new ConcurrentLinkedQueue[Future[String]] - Actor.registry.local.foreach(actor ⇒ results.add(actor.!!)) + Actor.registry.local.foreach(actor ⇒ results.add(actor.?[String]("ping"))) assert(results.size === 2) val i = results.iterator 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 ddd37f760c..2375d128a6 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala @@ -237,7 +237,7 @@ class RoutingSpec extends WordSpec with MustMatchers { }).start() try { - (for (count ← 1 to 500) yield pool.!!) foreach { + (for (count ← 1 to 500) yield pool.?[String]("Test", 20000)) foreach { _.await.resultOrException.get must be("Response") } } finally { @@ -283,7 +283,7 @@ class RoutingSpec extends WordSpec with MustMatchers { latch = TestLatch(loops) count.set(0) for (m ← 0 until loops) { - pool !!! t + pool ? t sleepFor(50 millis) } } 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 ac5bea25aa..f48f7b87af 100644 --- a/akka-actor-tests/src/test/scala/akka/ticket/Ticket703Spec.scala +++ b/akka-actor-tests/src/test/scala/akka/ticket/Ticket703Spec.scala @@ -8,7 +8,7 @@ import org.scalatest.matchers.MustMatchers class Ticket703Spec extends WordSpec with MustMatchers { - "A !!! call to an actor pool" should { + "A ? call to an actor pool" should { "reuse the proper timeout" in { val actorPool = actorOf( new Actor with DefaultActorPool with BoundedCapacityStrategy with MailboxPressureCapacitor with SmallestMailboxSelector with BasicNoBackoffFilter { @@ -28,7 +28,7 @@ class Ticket703Spec extends WordSpec with MustMatchers { } }) }).start() - (actorPool.!!).await.result must be === Some("Response") + (actorPool.?[String]("Ping", 7000)).await.result must be === Some("Response") } } } \ No newline at end of file diff --git a/akka-actor/src/main/scala/akka/actor/Actor.scala b/akka-actor/src/main/scala/akka/actor/Actor.scala index 67d4073a03..02b508db03 100644 --- a/akka-actor/src/main/scala/akka/actor/Actor.scala +++ b/akka-actor/src/main/scala/akka/actor/Actor.scala @@ -333,7 +333,7 @@ object Actor extends ListenerManagement { * This means that the following code is equivalent: * (actor !! "foo").as[Int] (Deprecated) * and - * (actor !!! "foo").as[Int] (Recommended) + * (actor ? "foo").as[Int] (Recommended) */ implicit def futureToAnyOptionAsTypedOption(anyFuture: Future[_]) = new AnyOptionAsTypedOption({ try { anyFuture.await } catch { case t: FutureTimeoutException ⇒ } @@ -475,7 +475,7 @@ object Actor extends ListenerManagement { * *
* Here you find functions like: - * - !, !!, !!! and forward + * - !, !!, ? and forward * - link, unlink, startLink etc * - start, stop * - etc. @@ -543,7 +543,7 @@ trait Actor { * Option[ActorRef] representation of the 'self' ActorRef reference. * * Mainly for internal use, functions as the implicit sender references when invoking - * one of the message send functions ('!', '!!' and '!!!'). + * one of the message send functions ('!', '!!' and '?'). */ implicit def optionSelf: Option[ActorRef] = someSelf diff --git a/akka-actor/src/main/scala/akka/actor/ActorRef.scala b/akka-actor/src/main/scala/akka/actor/ActorRef.scala index 1f2a6e7725..30814566bc 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorRef.scala @@ -101,8 +101,8 @@ trait ActorRef extends ActorRefShared with java.lang.Comparable[ActorRef] with S /** * User overridable callback/setting. * - * Defines the default timeout for '!!' and '!!!' invocations, - * e.g. the timeout for the future returned by the call to '!!' and '!!!'. + * Defines the default timeout for '!!' and '?' invocations, + * e.g. the timeout for the future returned by the call to '!!' and '?'. */ @deprecated("Will be replaced by implicit-scoped timeout on all methods that needs it, will default to timeout specified in config", "1.1") @BeanProperty @@ -210,7 +210,7 @@ trait ActorRef extends ActorRefShared with java.lang.Comparable[ActorRef] with S /** * Akka Java API. * The reference sender future of the last received message. - * Is defined if the message was sent with sent with '!!' or '!!!', else None. + * Is defined if the message was sent with sent with '!!' or '?', else None. */ def getSenderFuture: Option[Promise[Any]] = senderFuture @@ -297,7 +297,7 @@ trait ActorRef extends ActorRefShared with java.lang.Comparable[ActorRef] with S * If you are sending messages usingask 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[T <: AnyRef](message: AnyRef, timeout: Long, sender: ActorRef): Future[T] = !!!(message, timeout)(Option(sender)).asInstanceOf[Future[T]]
+ def ask[T <: AnyRef](message: AnyRef, timeout: Long, sender: ActorRef): Future[T] = ?(message, timeout)(Option(sender)).asInstanceOf[Future[T]]
/**
* Akka Java API.
@@ -1148,7 +1148,7 @@ trait ScalaActorRef extends ActorRefShared { ref: ActorRef ⇒
/**
* The reference sender future of the last received message.
- * Is defined if the message was sent with sent with '!!' or '!!!', else None.
+ * Is defined if the message was sent with sent with '!!' or '?', else None.
*/
def senderFuture(): Option[Promise[Any]] = {
val msg = currentMessage
@@ -1199,14 +1199,16 @@ trait ScalaActorRef extends ActorRefShared { ref: ActorRef ⇒
/**
* Sends a message asynchronously returns a future holding the eventual reply message.
+ * Synonymous to: ask
+ * Pronounced: "ask"
*
* NOTE:
* Use this method with care. In most cases it is better to use '!' together with the 'sender' member field to
* implement request/response message exchanges.
- * If you are sending messages using !!! then you have to use self.reply(..)
+ * If you are sending messages using ? then you have to use self.reply(..)
* to send a reply message to the original sender. If not then the sender will block until the timeout expires.
*/
- def !!(implicit sender: Option[ActorRef] = None): Future[T] = {
+ def ?[T](message: Any, timeout: Long = this.timeout)(implicit sender: Option[ActorRef] = None): Future[T] = {
if (isRunning) postMessageToMailboxAndCreateFutureResultWithTimeout[T](message, timeout, sender, None)
else throw new ActorInitializationException(
"Actor has not been started, you need to invoke 'actor.start()' before using it")
@@ -1215,7 +1217,7 @@ trait ScalaActorRef extends ActorRefShared { ref: ActorRef ⇒
/**
* Forwards the message and passes the original sender actor as the sender.
*
- * Works with '!', '!!' and '!!!'.
+ * Works with '!', '!!' and '?'.
*/
def forward(message: Any)(implicit sender: Some[ActorRef]) = {
if (isRunning) {
diff --git a/akka-actor/src/main/scala/akka/actor/TypedActor.scala b/akka-actor/src/main/scala/akka/actor/TypedActor.scala
index 85a388e24e..96324f3f4b 100644
--- a/akka-actor/src/main/scala/akka/actor/TypedActor.scala
+++ b/akka-actor/src/main/scala/akka/actor/TypedActor.scala
@@ -46,14 +46,14 @@ object TypedActor {
actor ! m
null
case m if m.returnsFuture_? ⇒
- actor !!! m
+ actor ? m
case m if m.returnsJOption_? || m.returnsOption_? ⇒
- (actor !!! m).as[AnyRef] match {
+ (actor ? m).as[AnyRef] match {
case Some(null) | None ⇒ if (m.returnsJOption_?) JOption.none[Any] else None
case Some(joption) ⇒ joption
}
case m ⇒
- (actor !!! m).get
+ (actor ? m).get
}
}
}
diff --git a/akka-actor/src/main/scala/akka/dispatch/Future.scala b/akka-actor/src/main/scala/akka/dispatch/Future.scala
index e760f97bb7..9d12105f1d 100644
--- a/akka-actor/src/main/scala/akka/dispatch/Future.scala
+++ b/akka-actor/src/main/scala/akka/dispatch/Future.scala
@@ -278,7 +278,7 @@ sealed trait Future[+T] {
* continuation until the result is available.
*
* If this Future is untyped (a Future[Nothing]), a type parameter must be explicitly provided or
- * execution will fail. The normal result of getting a Future from an ActorRef using !!! will return
+ * execution will fail. The normal result of getting a Future from an ActorRef using ? will return
* an untyped Future.
*/
def apply[A >: T](): A @cps[Future[Any]] = shift(this flatMap (_: A ⇒ Future[Any]))
@@ -403,9 +403,9 @@ sealed trait Future[+T] {
* Example:
*
* val future1 = for {
- * a <- actor !!! Req("Hello") collect { case Res(x: Int) => x }
- * b <- actor !!! Req(a) collect { case Res(x: String) => x }
- * c <- actor !!! Req(7) collect { case Res(x: String) => x }
+ * a <- actor ? Req("Hello") collect { case Res(x: Int) => x }
+ * b <- actor ? Req(a) collect { case Res(x: String) => x }
+ * c <- actor ? Req(7) collect { case Res(x: String) => x }
* } yield b + "-" + c
*
*/
@@ -468,9 +468,9 @@ sealed trait Future[+T] {
* Example:
*
* val future1 = for {
- * a: Int <- actor !!! "Hello" // returns 5
- * b: String <- actor !!! a // returns "10"
- * c: String <- actor !!! 7 // returns "14"
+ * a: Int <- actor ? "Hello" // returns 5
+ * b: String <- actor ? a // returns "10"
+ * c: String <- actor ? 7 // returns "14"
* } yield b + "-" + c
*
*/
@@ -504,9 +504,9 @@ sealed trait Future[+T] {
* Example:
*
* val future1 = for {
- * a: Int <- actor !!! "Hello" // returns 5
- * b: String <- actor !!! a // returns "10"
- * c: String <- actor !!! 7 // returns "14"
+ * a: Int <- actor ? "Hello" // returns 5
+ * b: String <- actor ? a // returns "10"
+ * c: String <- actor ? 7 // returns "14"
* } yield b + "-" + c
*
*/
diff --git a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala
index a5b76b646c..5648aebb34 100644
--- a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala
+++ b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala
@@ -1056,7 +1056,7 @@ class DefaultClusterNode private[akka] (
.setMessageType(FUNCTION_FUN0_ANY)
.setPayload(ByteString.copyFrom(Serializers.Java.toBinary(f)))
.build
- val results = replicaConnectionsForReplicationFactor(replicationFactor) map (_ !!! message)
+ val results = replicaConnectionsForReplicationFactor(replicationFactor) map (_ ? message)
results.toList.asInstanceOf[List[Future[Any]]]
}
@@ -1082,7 +1082,7 @@ class DefaultClusterNode private[akka] (
.setMessageType(FUNCTION_FUN1_ARG_ANY)
.setPayload(ByteString.copyFrom(Serializers.Java.toBinary((f, arg))))
.build
- val results = replicaConnectionsForReplicationFactor(replicationFactor) map (_ !!! message)
+ val results = replicaConnectionsForReplicationFactor(replicationFactor) map (_ ? message)
results.toList.asInstanceOf[List[Future[Any]]]
}
diff --git a/akka-cluster/src/main/scala/akka/cluster/Routing.scala b/akka-cluster/src/main/scala/akka/cluster/Routing.scala
index d3bc4904f7..4ac6b0f4ab 100644
--- a/akka-cluster/src/main/scala/akka/cluster/Routing.scala
+++ b/akka-cluster/src/main/scala/akka/cluster/Routing.scala
@@ -56,7 +56,7 @@ object Router {
}
def route[T](message: Any, timeout: Long)(implicit sender: Option[ActorRef]): Future[T] = next match {
- case Some(actor) ⇒ actor.!!!(message, timeout)(sender)
+ case Some(actor) ⇒ actor.?(message, timeout)(sender)
case _ ⇒ throwNoConnectionsError()
}
diff --git a/akka-docs/cluster/durable-mailbox.rst b/akka-docs/cluster/durable-mailbox.rst
index 2d6fd2752e..b24e1fea30 100644
--- a/akka-docs/cluster/durable-mailbox.rst
+++ b/akka-docs/cluster/durable-mailbox.rst
@@ -18,7 +18,7 @@ in its mailbox.
.. sidebar:: **IMPORTANT**
None of these mailboxes work with blocking message send, e.g. the message
- send operations that are relying on futures; ``!!``, ``!!!``,
+ send operations that are relying on futures; ``!!``, ``?``,
``sendRequestReply`` and ``ask``. If the node has crashed
and then restarted, the thread that was blocked waiting for the reply is gone
and there is no way we can deliver the message.
diff --git a/akka-docs/disabled/getting-started-first.rst b/akka-docs/disabled/getting-started-first.rst
index 6c955dc7f2..b0817fa22f 100644
--- a/akka-docs/disabled/getting-started-first.rst
+++ b/akka-docs/disabled/getting-started-first.rst
@@ -67,7 +67,7 @@ Here is the master actor:
A couple of things are worth explaining further.
-First, we are passing in a ``java.util.concurrent.CountDownLatch`` to the ``Master`` actor. This latch is only used for plumbing (in this specific tutorial), to have a simple way of letting the outside world knowing when the master can deliver the result and shut down. In more idiomatic Akka code, as we will see in part two of this tutorial series, we would not use a latch but other abstractions and functions like ``Channel``, ``Future`` and ``!!!`` to achive the same thing in a non-blocking way. But for simplicity let's stick to a ``CountDownLatch`` for now.
+First, we are passing in a ``java.util.concurrent.CountDownLatch`` to the ``Master`` actor. This latch is only used for plumbing (in this specific tutorial), to have a simple way of letting the outside world knowing when the master can deliver the result and shut down. In more idiomatic Akka code, as we will see in part two of this tutorial series, we would not use a latch but other abstractions and functions like ``Channel``, ``Future`` and ``?`` to achive the same thing in a non-blocking way. But for simplicity let's stick to a ``CountDownLatch`` for now.
Second, we are adding a couple of life-cycle callback methods; ``preStart`` and ``postStop``. In the ``preStart`` callback we are recording the time when the actor is started and in the ``postStop`` callback we are printing out the result (the approximation of Pi) and the time it took to calculate it. In this call we also invoke ``latch.countDown`` to tell the outside world that we are done.
diff --git a/akka-docs/intro/getting-started-first-java.rst b/akka-docs/intro/getting-started-first-java.rst
index 07c74dde63..57bfd01db9 100644
--- a/akka-docs/intro/getting-started-first-java.rst
+++ b/akka-docs/intro/getting-started-first-java.rst
@@ -435,7 +435,7 @@ Here is the master actor::
A couple of things are worth explaining further.
-First, we are passing in a ``java.util.concurrent.CountDownLatch`` to the ``Master`` actor. This latch is only used for plumbing (in this specific tutorial), to have a simple way of letting the outside world knowing when the master can deliver the result and shut down. In more idiomatic Akka code, as we will see in part two of this tutorial series, we would not use a latch but other abstractions and functions like ``Channel``, ``Future`` and ``!!!`` to achieve the same thing in a non-blocking way. But for simplicity let's stick to a ``CountDownLatch`` for now.
+First, we are passing in a ``java.util.concurrent.CountDownLatch`` to the ``Master`` actor. This latch is only used for plumbing (in this specific tutorial), to have a simple way of letting the outside world knowing when the master can deliver the result and shut down. In more idiomatic Akka code, as we will see in part two of this tutorial series, we would not use a latch but other abstractions and functions like ``Channel``, ``Future`` and ``?`` to achieve the same thing in a non-blocking way. But for simplicity let's stick to a ``CountDownLatch`` for now.
Second, we are adding a couple of life-cycle callback methods; ``preStart`` and ``postStop``. In the ``preStart`` callback we are recording the time when the actor is started and in the ``postStop`` callback we are printing out the result (the approximation of Pi) and the time it took to calculate it. In this call we also invoke ``latch.countDown()`` to tell the outside world that we are done.
diff --git a/akka-docs/intro/getting-started-first-scala-eclipse.rst b/akka-docs/intro/getting-started-first-scala-eclipse.rst
index 3e4da8f619..d9c7356471 100644
--- a/akka-docs/intro/getting-started-first-scala-eclipse.rst
+++ b/akka-docs/intro/getting-started-first-scala-eclipse.rst
@@ -335,7 +335,7 @@ Here is the master actor::
A couple of things are worth explaining further.
-First, we are passing in a ``java.util.concurrent.CountDownLatch`` to the ``Master`` actor. This latch is only used for plumbing (in this specific tutorial), to have a simple way of letting the outside world knowing when the master can deliver the result and shut down. In more idiomatic Akka code, as we will see in part two of this tutorial series, we would not use a latch but other abstractions and functions like ``Channel``, ``Future`` and ``!!!`` to achieve the same thing in a non-blocking way. But for simplicity let's stick to a ``CountDownLatch`` for now.
+First, we are passing in a ``java.util.concurrent.CountDownLatch`` to the ``Master`` actor. This latch is only used for plumbing (in this specific tutorial), to have a simple way of letting the outside world knowing when the master can deliver the result and shut down. In more idiomatic Akka code, as we will see in part two of this tutorial series, we would not use a latch but other abstractions and functions like ``Channel``, ``Future`` and ``?`` to achieve the same thing in a non-blocking way. But for simplicity let's stick to a ``CountDownLatch`` for now.
Second, we are adding a couple of life-cycle callback methods; ``preStart`` and ``postStop``. In the ``preStart`` callback we are recording the time when the actor is started and in the ``postStop`` callback we are printing out the result (the approximation of Pi) and the time it took to calculate it. In this call we also invoke ``latch.countDown`` to tell the outside world that we are done.
diff --git a/akka-docs/intro/getting-started-first-scala.rst b/akka-docs/intro/getting-started-first-scala.rst
index 2873531dfe..05ce8a15ce 100644
--- a/akka-docs/intro/getting-started-first-scala.rst
+++ b/akka-docs/intro/getting-started-first-scala.rst
@@ -329,7 +329,7 @@ Here is the master actor::
A couple of things are worth explaining further.
-First, we are passing in a ``java.util.concurrent.CountDownLatch`` to the ``Master`` actor. This latch is only used for plumbing (in this specific tutorial), to have a simple way of letting the outside world knowing when the master can deliver the result and shut down. In more idiomatic Akka code, as we will see in part two of this tutorial series, we would not use a latch but other abstractions and functions like ``Channel``, ``Future`` and ``!!!`` to achieve the same thing in a non-blocking way. But for simplicity let's stick to a ``CountDownLatch`` for now.
+First, we are passing in a ``java.util.concurrent.CountDownLatch`` to the ``Master`` actor. This latch is only used for plumbing (in this specific tutorial), to have a simple way of letting the outside world knowing when the master can deliver the result and shut down. In more idiomatic Akka code, as we will see in part two of this tutorial series, we would not use a latch but other abstractions and functions like ``Channel``, ``Future`` and ``?`` to achieve the same thing in a non-blocking way. But for simplicity let's stick to a ``CountDownLatch`` for now.
Second, we are adding a couple of life-cycle callback methods; ``preStart`` and ``postStop``. In the ``preStart`` callback we are recording the time when the actor is started and in the ``postStop`` callback we are printing out the result (the approximation of Pi) and the time it took to calculate it. In this call we also invoke ``latch.countDown`` to tell the outside world that we are done.
diff --git a/akka-docs/scala/actors.rst b/akka-docs/scala/actors.rst
index 38076d7b58..2d0f105e0e 100644
--- a/akka-docs/scala/actors.rst
+++ b/akka-docs/scala/actors.rst
@@ -126,7 +126,7 @@ Messages are sent to an Actor through one of the “bang” methods.
* ! means “fire-and-forget”, e.g. send a message asynchronously and return immediately.
* !! means “send-and-reply-eventually”, e.g. send a message asynchronously and wait for a reply through aFuture. Here you can specify a timeout. Using timeouts is very important. If no timeout is specified then the actor’s default timeout (set by the this.timeout variable in the actor) is used. This method returns an ``Option[Any]`` which will be either ``Some(result)`` if returning successfully or None if the call timed out.
-* !!! sends a message asynchronously and returns a ``Future``.
+* ? sends a message asynchronously and returns a ``Future``.
You can check if an Actor can handle a specific message by invoking the ``isDefinedAt`` method:
@@ -180,11 +180,11 @@ Here are some examples:
Send-And-Receive-Future
^^^^^^^^^^^^^^^^^^^^^^^
-Using ``!!!`` will send a message to the receiving Actor asynchronously and will return a 'Future':
+Using ``?`` will send a message to the receiving Actor asynchronously and will return a 'Future':
.. code-block:: scala
- val future = actor !!! "Hello"
+ val future = actor ? "Hello"
See :ref:`futures-scala` for more information.
@@ -329,7 +329,7 @@ The same pattern holds for using the ``senderFuture`` in the section below.
Reply using the sender future
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-If a message was sent with the ``!!`` or ``!!!`` methods, which both implements request-reply semantics using Future's, then you either have the option of replying using the ``reply`` method as above. This method will then resolve the Future. But you can also get a reference to the Future directly and resolve it yourself or if you would like to store it away to resolve it later, or pass it on to some other Actor to resolve it.
+If a message was sent with the ``!!`` or ``?`` methods, which both implements request-reply semantics using Future's, then you either have the option of replying using the ``reply`` method as above. This method will then resolve the Future. But you can also get a reference to the Future directly and resolve it yourself or if you would like to store it away to resolve it later, or pass it on to some other Actor to resolve it.
The reference to the Future resides in the ``senderFuture: Option[Promise[_]]`` member field in the ``ActorRef`` class.
@@ -427,7 +427,7 @@ PoisonPill
You can also send an actor the ``akka.actor.PoisonPill`` message, which will stop the actor when the message is processed.
-If the sender is a ``Future`` (e.g. the message is sent with ``!!`` or ``!!!``), the ``Future`` will be completed with an ``akka.actor.ActorKilledException("PoisonPill")``.
+If the sender is a ``Future`` (e.g. the message is sent with ``!!`` or ``?``), the ``Future`` will be completed with an ``akka.actor.ActorKilledException("PoisonPill")``.
HotSwap
-------
@@ -457,7 +457,7 @@ To hotswap the Actor using ``become``:
.. code-block:: scala
def angry: Receive = {
- case "foo" => self reply "I am already angry!!!"
+ case "foo" => self reply "I am already angry?"
case "bar" => become(happy)
}
diff --git a/akka-docs/scala/futures.rst b/akka-docs/scala/futures.rst
index de58118a4f..a9955d9a50 100644
--- a/akka-docs/scala/futures.rst
+++ b/akka-docs/scala/futures.rst
@@ -17,11 +17,11 @@ Use with Actors
There are generally two ways of getting a reply from an ``Actor``: the first is by a sent message (``actor ! msg``), which only works if the original sender was an ``Actor``) and the second is through a ``Future``.
-Using an ``Actor``\'s ``!!!`` method to send a message will return a Future. To wait for and retrieve the actual result the simplest method is:
+Using an ``Actor``\'s ``?`` method to send a message will return a Future. To wait for and retrieve the actual result the simplest method is:
.. code-block:: scala
- val future = actor !!! msg
+ val future = actor ? msg
val result: Any = future.get()
This will cause the current thread to block and wait for the ``Actor`` to 'complete' the ``Future`` with it's reply. Due to the dynamic nature of Akka's ``Actor``\s this result will be untyped and will default to ``Nothing``. The safest way to deal with this is to cast the result to an ``Any`` as is shown in the above example. You can also use the expected result type instead of ``Any``, but if an unexpected type were to be returned you will get a ``ClassCastException``. For more elegant ways to deal with this and to use the result without blocking, refer to `Functional Futures`_.
@@ -141,13 +141,13 @@ The example for comprehension above is an example of composing ``Future``\s. A c
.. code-block:: scala
- val f1 = actor1 !!! msg1
- val f2 = actor2 !!! msg2
+ val f1 = actor1 ? msg1
+ val f2 = actor2 ? msg2
val a: Int = f1.get()
val b: Int = f2.get()
- val f3 = actor3 !!! (a + b)
+ val f3 = actor3 ? (a + b)
val result: String = f3.get()
@@ -155,13 +155,13 @@ Here we wait for the results from the first 2 ``Actor``\s before sending that re
.. code-block:: scala
- val f1 = actor1 !!! msg1
- val f2 = actor2 !!! msg2
+ val f1 = actor1 ? msg1
+ val f2 = actor2 ? msg2
val f3 = for {
a: Int <- f1
b: Int <- f2
- c: String <- actor3 !!! (a + b)
+ c: String <- actor3 ? (a + b)
} yield c
val result = f3.get()
@@ -173,7 +173,7 @@ This is fine when dealing with a known amount of Actors, but can grow unwieldy i
.. code-block:: scala
// oddActor returns odd numbers sequentially from 1
- val listOfFutures: List[Future[Int]] = List.fill(100)(oddActor !!! GetNext)
+ val listOfFutures: List[Future[Int]] = List.fill(100)(oddActor ? GetNext)
// now we have a Future[List[Int]]
val futureList = Future.sequence(listOfFutures)
@@ -242,7 +242,7 @@ It is also possible to handle an ``Exception`` by returning a different result.
.. code-block:: scala
- val future = actor !!! msg1 recover {
+ val future = actor ? msg1 recover {
case e: ArithmeticException => 0
}
diff --git a/akka-durable-mailboxes/akka-mailboxes-common/src/main/scala/akka/actor/mailbox/DurableDispatcher.scala b/akka-durable-mailboxes/akka-mailboxes-common/src/main/scala/akka/actor/mailbox/DurableDispatcher.scala
index 142fbea84f..599cc21f5c 100644
--- a/akka-durable-mailboxes/akka-mailboxes-common/src/main/scala/akka/actor/mailbox/DurableDispatcher.scala
+++ b/akka-durable-mailboxes/akka-mailboxes-common/src/main/scala/akka/actor/mailbox/DurableDispatcher.scala
@@ -95,7 +95,7 @@ case class DurableDispatcher(
private[akka] override def dispatch(invocation: MessageInvocation): Unit = {
if (invocation.senderFuture.isDefined)
- throw new IllegalArgumentException("Durable mailboxes do not support Future-based messages from !! and !!!")
+ throw new IllegalArgumentException("Durable mailboxes do not support Future-based messages from !! and ?")
super.dispatch(invocation)
}
@@ -132,7 +132,7 @@ case class DurablePinnedDispatcher(
private[akka] override def dispatch(invocation: MessageInvocation): Unit = {
if (invocation.senderFuture.isDefined)
- throw new IllegalArgumentException("Actor has a durable mailbox that does not support !! or !!!")
+ throw new IllegalArgumentException("Actor has a durable mailbox that does not support !! or ?")
super.dispatch(invocation)
}
}
diff --git a/akka-spring/src/test/resources/akka-test.conf b/akka-spring/src/test/resources/akka-test.conf
index a84c60798a..a32dc0f338 100644
--- a/akka-spring/src/test/resources/akka-test.conf
+++ b/akka-spring/src/test/resources/akka-test.conf
@@ -25,7 +25,7 @@ akka {
actor {
timeout = 2000 # Default timeout for Future based invocations
- # - Actor: !! && !!!
+ # - Actor: !! && ?
# - UntypedActor: sendRequestReply && ask
# - TypedActor: methods with non-void return type
serialize-messages = off # Does a deep clone of (non-primitive) messages to ensure immutability
diff --git a/akka-stm/src/main/scala/akka/agent/Agent.scala b/akka-stm/src/main/scala/akka/agent/Agent.scala
index dfa3cfd6b8..300a038020 100644
--- a/akka-stm/src/main/scala/akka/agent/Agent.scala
+++ b/akka-stm/src/main/scala/akka/agent/Agent.scala
@@ -120,7 +120,7 @@ class Agent[T](initialValue: T) {
* within the given timeout
*/
def alter(f: T ⇒ T)(timeout: Long): Future[T] = {
- def dispatch = updater.!!!(Update(f), timeout)
+ def dispatch = updater.?(Update(f), timeout)
if (Stm.activeTransaction) {
val result = new DefaultPromise[T](timeout)
get //Join xa
@@ -168,7 +168,7 @@ class Agent[T](initialValue: T) {
send((value: T) ⇒ {
suspend
val threadBased = Actor.actorOf(new ThreadBasedAgentUpdater(this)).start()
- result completeWith threadBased.!!!(Update(f), timeout)
+ result completeWith threadBased.?(Update(f), timeout)
value
})
result
@@ -178,7 +178,7 @@ class Agent[T](initialValue: T) {
* A future to the current value that will be completed after any currently
* queued updates.
*/
- def future(): Future[T] = (updater !!! Get).asInstanceOf[Future[T]]
+ def future(): Future[T] = (updater ? Get).asInstanceOf[Future[T]]
/**
* Gets this agent's value after all currently queued updates have completed.
diff --git a/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala
index 5d74db9b34..c952697fe7 100644
--- a/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala
+++ b/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala
@@ -190,7 +190,7 @@ class TestActorRefSpec extends WordSpec with MustMatchers with BeforeAndAfterEac
"support futures" in {
val a = TestActorRef[WorkerActor].start()
- val f: Future[String] = a !!! "work"
+ val f: Future[String] = a ? "work"
f must be('completed)
f.get must equal("workDone")
}
diff --git a/akka-tutorials/akka-tutorial-second/src/main/scala/Pi.scala b/akka-tutorials/akka-tutorial-second/src/main/scala/Pi.scala
index ff4b8d9c4a..e36f0a03d9 100644
--- a/akka-tutorials/akka-tutorial-second/src/main/scala/Pi.scala
+++ b/akka-tutorials/akka-tutorial-second/src/main/scala/Pi.scala
@@ -104,7 +104,7 @@ object Pi extends App {
val start = now
//send calculate message
- master.!!.
+ master.?[Double](Calculate, timeout = 60000).
await.resultOrException match {//wait for the result, with a 60 seconds timeout
case Some(pi) =>
EventHandler.info(this, "\n\tPi estimate: \t\t%s\n\tCalculation time: \t%s millis".format(pi, (now - start)))
diff --git a/config/akka-reference.conf b/config/akka-reference.conf
index 5793377029..9b43aa97b1 100644
--- a/config/akka-reference.conf
+++ b/config/akka-reference.conf
@@ -28,7 +28,7 @@ akka {
actor {
timeout = 5 # Default timeout for Future based invocations
- # - Actor: !! && !!!
+ # - Actor: !! && ?
# - UntypedActor: sendRequestReply && ask
# - TypedActor: methods with non-void return type
serialize-messages = off # Does a deep clone of (non-primitive) messages to ensure immutability