Removing ActorTimeoutException everywhere... I swear it...

This commit is contained in:
Viktor Klang 2012-05-18 15:04:08 +02:00
parent 5afe6601ff
commit 2bb255b480
8 changed files with 16 additions and 17 deletions

View file

@ -46,7 +46,7 @@ trait AskSupport {
* Sends a message asynchronously and returns a [[akka.dispatch.Future]] * Sends a message asynchronously and returns a [[akka.dispatch.Future]]
* holding the eventual reply message; this means that the target actor * holding the eventual reply message; this means that the target actor
* needs to send the result to the `sender` reference provided. The Future * needs to send the result to the `sender` reference provided. The Future
* will be completed with an [[akka.actor.AskTimeoutException]] after the * will be completed with an [[akka.pattern.AskTimeoutException]] after the
* given timeout has expired; this is independent from any timeout applied * given timeout has expired; this is independent from any timeout applied
* while awaiting a result for this future (i.e. in * while awaiting a result for this future (i.e. in
* `Await.result(..., timeout)`). * `Await.result(..., timeout)`).
@ -96,7 +96,7 @@ trait AskSupport {
* Sends a message asynchronously and returns a [[akka.dispatch.Future]] * Sends a message asynchronously and returns a [[akka.dispatch.Future]]
* holding the eventual reply message; this means that the target actor * holding the eventual reply message; this means that the target actor
* needs to send the result to the `sender` reference provided. The Future * needs to send the result to the `sender` reference provided. The Future
* will be completed with an [[akka.actor.AskTimeoutException]] after the * will be completed with an [[akka.pattern.AskTimeoutException]] after the
* given timeout has expired; this is independent from any timeout applied * given timeout has expired; this is independent from any timeout applied
* while awaiting a result for this future (i.e. in * while awaiting a result for this future (i.e. in
* `Await.result(..., timeout)`). * `Await.result(..., timeout)`).
@ -126,7 +126,7 @@ trait AskSupport {
* Sends a message asynchronously and returns a [[akka.dispatch.Future]] * Sends a message asynchronously and returns a [[akka.dispatch.Future]]
* holding the eventual reply message; this means that the target actor * holding the eventual reply message; this means that the target actor
* needs to send the result to the `sender` reference provided. The Future * needs to send the result to the `sender` reference provided. The Future
* will be completed with an [[akka.actor.AskTimeoutException]] after the * will be completed with an [[akka.pattern.AskTimeoutException]] after the
* given timeout has expired; this is independent from any timeout applied * given timeout has expired; this is independent from any timeout applied
* while awaiting a result for this future (i.e. in * while awaiting a result for this future (i.e. in
* `Await.result(..., timeout)`). * `Await.result(..., timeout)`).

View file

@ -18,7 +18,7 @@ trait GracefulStopSupport {
* which should only be done outside of the ActorSystem as blocking inside Actors is discouraged. * which should only be done outside of the ActorSystem as blocking inside Actors is discouraged.
* *
* If the target actor isn't terminated within the timeout the [[akka.dispatch.Future]] * If the target actor isn't terminated within the timeout the [[akka.dispatch.Future]]
* is completed with failure [[akka.actor.ActorTimeoutException]]. * is completed with failure [[akka.pattern.AskTimeoutException]].
*/ */
def gracefulStop(target: ActorRef, timeout: Duration)(implicit system: ActorSystem): Future[Boolean] = { def gracefulStop(target: ActorRef, timeout: Duration)(implicit system: ActorSystem): Future[Boolean] = {
if (target.isTerminated) { if (target.isTerminated) {

View file

@ -18,7 +18,7 @@ object Patterns {
* Sends a message asynchronously and returns a [[akka.dispatch.Future]] * Sends a message asynchronously and returns a [[akka.dispatch.Future]]
* holding the eventual reply message; this means that the target actor * holding the eventual reply message; this means that the target actor
* needs to send the result to the `sender` reference provided. The Future * needs to send the result to the `sender` reference provided. The Future
* will be completed with an [[akka.actor.AskTimeoutException]] after the * will be completed with an [[akka.pattern.AskTimeoutException]] after the
* given timeout has expired; this is independent from any timeout applied * given timeout has expired; this is independent from any timeout applied
* while awaiting a result for this future (i.e. in * while awaiting a result for this future (i.e. in
* `Await.result(..., timeout)`). * `Await.result(..., timeout)`).
@ -49,7 +49,7 @@ object Patterns {
* Sends a message asynchronously and returns a [[akka.dispatch.Future]] * Sends a message asynchronously and returns a [[akka.dispatch.Future]]
* holding the eventual reply message; this means that the target actor * holding the eventual reply message; this means that the target actor
* needs to send the result to the `sender` reference provided. The Future * needs to send the result to the `sender` reference provided. The Future
* will be completed with an [[akka.actor.AskTimeoutException]] after the * will be completed with an [[akka.pattern.AskTimeoutException]] after the
* given timeout has expired; this is independent from any timeout applied * given timeout has expired; this is independent from any timeout applied
* while awaiting a result for this future (i.e. in * while awaiting a result for this future (i.e. in
* `Await.result(..., timeout)`). * `Await.result(..., timeout)`).
@ -100,7 +100,7 @@ object Patterns {
* Useful when you need to wait for termination or compose ordered termination of several actors. * Useful when you need to wait for termination or compose ordered termination of several actors.
* *
* If the target actor isn't terminated within the timeout the [[akka.dispatch.Future]] * If the target actor isn't terminated within the timeout the [[akka.dispatch.Future]]
* is completed with failure [[akka.actor.ActorTimeoutException]]. * is completed with failure [[akka.pattern.AskTimeoutException]].
*/ */
def gracefulStop(target: ActorRef, timeout: Duration, system: ActorSystem): Future[java.lang.Boolean] = def gracefulStop(target: ActorRef, timeout: Duration, system: ActorSystem): Future[java.lang.Boolean] =
scalaGracefulStop(target, timeout)(system).asInstanceOf[Future[java.lang.Boolean]] scalaGracefulStop(target, timeout)(system).asInstanceOf[Future[java.lang.Boolean]]

View file

@ -36,7 +36,7 @@ import static akka.pattern.Patterns.gracefulStop;
import akka.dispatch.Future; import akka.dispatch.Future;
import akka.dispatch.Await; import akka.dispatch.Await;
import akka.util.Duration; import akka.util.Duration;
import akka.actor.ActorTimeoutException; import akka.pattern.AskTimeoutException;
//#import-gracefulStop //#import-gracefulStop
//#import-askPipe //#import-askPipe
@ -207,7 +207,7 @@ public class UntypedActorDocTestBase {
Future<Boolean> stopped = gracefulStop(actorRef, Duration.create(5, TimeUnit.SECONDS), system); Future<Boolean> stopped = gracefulStop(actorRef, Duration.create(5, TimeUnit.SECONDS), system);
Await.result(stopped, Duration.create(6, TimeUnit.SECONDS)); Await.result(stopped, Duration.create(6, TimeUnit.SECONDS));
// the actor has been stopped // the actor has been stopped
} catch (ActorTimeoutException e) { } catch (AskTimeoutException e) {
// the actor wasn't stopped within 5 seconds // the actor wasn't stopped within 5 seconds
} }
//#gracefulStop //#gracefulStop

View file

@ -326,14 +326,13 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
//#gracefulStop //#gracefulStop
import akka.pattern.gracefulStop import akka.pattern.gracefulStop
import akka.dispatch.Await import akka.dispatch.Await
import akka.actor.ActorTimeoutException
try { try {
val stopped: Future[Boolean] = gracefulStop(actorRef, 5 seconds)(system) val stopped: Future[Boolean] = gracefulStop(actorRef, 5 seconds)(system)
Await.result(stopped, 6 seconds) Await.result(stopped, 6 seconds)
// the actor has been stopped // the actor has been stopped
} catch { } catch {
case e: ActorTimeoutException // the actor wasn't stopped within 5 seconds case e: akka.pattern.AskTimeoutException // the actor wasn't stopped within 5 seconds
} }
//#gracefulStop //#gracefulStop
} }

View file

@ -12,7 +12,7 @@ import akka.util.duration._
import akka.util.Timeout import akka.util.Timeout
import akka.testkit._ import akka.testkit._
import scala.concurrent.stm._ import scala.concurrent.stm._
import akka.pattern.ask import akka.pattern.{ AskTimeoutException, ask }
object CoordinatedIncrement { object CoordinatedIncrement {
@ -96,7 +96,7 @@ class CoordinatedIncrementSpec extends AkkaSpec(CoordinatedIncrement.config) wit
val ignoreExceptions = Seq( val ignoreExceptions = Seq(
EventFilter[ExpectedFailureException](), EventFilter[ExpectedFailureException](),
EventFilter[CoordinatedTransactionException](), EventFilter[CoordinatedTransactionException](),
EventFilter[ActorTimeoutException]()) EventFilter[AskTimeoutException]())
filterEvents(ignoreExceptions) { filterEvents(ignoreExceptions) {
val (counters, failer) = actorOfs val (counters, failer) = actorOfs
val coordinated = Coordinated() val coordinated = Coordinated()

View file

@ -15,7 +15,7 @@ import akka.testkit.TestEvent.Mute
import scala.concurrent.stm._ import scala.concurrent.stm._
import scala.util.Random.{ nextInt random } import scala.util.Random.{ nextInt random }
import java.util.concurrent.CountDownLatch import java.util.concurrent.CountDownLatch
import akka.pattern.ask import akka.pattern.{ AskTimeoutException, ask }
object FickleFriends { object FickleFriends {
case class FriendlyIncrement(friends: Seq[ActorRef], timeout: Timeout, latch: CountDownLatch) case class FriendlyIncrement(friends: Seq[ActorRef], timeout: Timeout, latch: CountDownLatch)
@ -120,7 +120,7 @@ class FickleFriendsSpec extends AkkaSpec with BeforeAndAfterAll {
val ignoreExceptions = Seq( val ignoreExceptions = Seq(
EventFilter[ExpectedFailureException](), EventFilter[ExpectedFailureException](),
EventFilter[CoordinatedTransactionException](), EventFilter[CoordinatedTransactionException](),
EventFilter[ActorTimeoutException]()) EventFilter[AskTimeoutException]())
system.eventStream.publish(Mute(ignoreExceptions)) system.eventStream.publish(Mute(ignoreExceptions))
val (counters, coordinator) = actorOfs val (counters, coordinator) = actorOfs
val latch = new CountDownLatch(1) val latch = new CountDownLatch(1)

View file

@ -10,7 +10,7 @@ import akka.util.duration._
import akka.util.Timeout import akka.util.Timeout
import akka.testkit._ import akka.testkit._
import scala.concurrent.stm._ import scala.concurrent.stm._
import akka.pattern.ask import akka.pattern.{ AskTimeoutException, ask }
object TransactorIncrement { object TransactorIncrement {
case class Increment(friends: Seq[ActorRef], latch: TestLatch) case class Increment(friends: Seq[ActorRef], latch: TestLatch)
@ -105,7 +105,7 @@ class TransactorSpec extends AkkaSpec {
val ignoreExceptions = Seq( val ignoreExceptions = Seq(
EventFilter[ExpectedFailureException](), EventFilter[ExpectedFailureException](),
EventFilter[CoordinatedTransactionException](), EventFilter[CoordinatedTransactionException](),
EventFilter[ActorTimeoutException]()) EventFilter[AskTimeoutException]())
filterEvents(ignoreExceptions) { filterEvents(ignoreExceptions) {
val (counters, failer) = createTransactors val (counters, failer) = createTransactors
val failLatch = TestLatch(numCounters) val failLatch = TestLatch(numCounters)