This commit is contained in:
parent
c57c6eda7e
commit
d2eb2b7949
3 changed files with 7 additions and 7 deletions
|
|
@ -59,7 +59,7 @@ class AskSpec extends AkkaSpec {
|
|||
implicit val timeout = Timeout(0 seconds)
|
||||
val echo = system.actorOf(Props(new Actor { def receive = { case x ⇒ sender() ! x } }))
|
||||
val f = echo ? "foo"
|
||||
val expectedMsg = "Timeout length must not be negative, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo
|
||||
val expectedMsg = "Timeout length must be positive, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo
|
||||
intercept[IllegalArgumentException] {
|
||||
Await.result(f, timeout.duration)
|
||||
}.getMessage should ===(expectedMsg)
|
||||
|
|
@ -69,7 +69,7 @@ class AskSpec extends AkkaSpec {
|
|||
implicit val timeout = Timeout(-1000 seconds)
|
||||
val echo = system.actorOf(Props(new Actor { def receive = { case x ⇒ sender() ! x } }))
|
||||
val f = echo ? "foo"
|
||||
val expectedMsg = "Timeout length must not be negative, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo
|
||||
val expectedMsg = "Timeout length must be positive, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo
|
||||
intercept[IllegalArgumentException] {
|
||||
Await.result(f, timeout.duration)
|
||||
}.getMessage should ===(expectedMsg)
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ final class AskableActorRef(val actorRef: ActorRef) extends AnyVal {
|
|||
Future.failed[Any](new AskTimeoutException(s"""Recipient[$actorRef] had already been terminated. Sender[$sender] sent the message of type "${message.getClass.getName}"."""))
|
||||
case ref: InternalActorRef ⇒
|
||||
if (timeout.duration.length <= 0)
|
||||
Future.failed[Any](new IllegalArgumentException(s"""Timeout length must not be negative, question not sent to [$actorRef]. Sender[$sender] sent the message of type "${message.getClass.getName}"."""))
|
||||
Future.failed[Any](new IllegalArgumentException(s"""Timeout length must be positive, question not sent to [$actorRef]. Sender[$sender] sent the message of type "${message.getClass.getName}"."""))
|
||||
else {
|
||||
val a = PromiseActorRef(ref.provider, timeout, targetName = actorRef, message.getClass.getName, sender)
|
||||
actorRef.tell(message, a)
|
||||
|
|
@ -322,7 +322,7 @@ final class ExplicitlyAskableActorRef(val actorRef: ActorRef) extends AnyVal {
|
|||
case ref: InternalActorRef ⇒
|
||||
if (timeout.duration.length <= 0) {
|
||||
val message = messageFactory(ref.provider.deadLetters)
|
||||
Future.failed[Any](new IllegalArgumentException(s"""Timeout length must not be negative, question not sent to [$actorRef]. Sender[$sender] sent the message of type "${message.getClass.getName}"."""))
|
||||
Future.failed[Any](new IllegalArgumentException(s"""Timeout length must be positive, question not sent to [$actorRef]. Sender[$sender] sent the message of type "${message.getClass.getName}"."""))
|
||||
} else {
|
||||
val a = PromiseActorRef(ref.provider, timeout, targetName = actorRef, "unknown", sender)
|
||||
val message = messageFactory(a)
|
||||
|
|
@ -382,7 +382,7 @@ final class AskableActorSelection(val actorSel: ActorSelection) extends AnyVal {
|
|||
case ref: InternalActorRef ⇒
|
||||
if (timeout.duration.length <= 0)
|
||||
Future.failed[Any](
|
||||
new IllegalArgumentException(s"""Timeout length must not be negative, question not sent to [$actorSel]. Sender[$sender] sent the message of type "${message.getClass.getName}"."""))
|
||||
new IllegalArgumentException(s"""Timeout length must be positive, question not sent to [$actorSel]. Sender[$sender] sent the message of type "${message.getClass.getName}"."""))
|
||||
else {
|
||||
val a = PromiseActorRef(ref.provider, timeout, targetName = actorSel, message.getClass.getName, sender)
|
||||
actorSel.tell(message, a)
|
||||
|
|
@ -411,7 +411,7 @@ final class ExplicitlyAskableActorSelection(val actorSel: ActorSelection) extend
|
|||
if (timeout.duration.length <= 0) {
|
||||
val message = messageFactory(ref.provider.deadLetters)
|
||||
Future.failed[Any](
|
||||
new IllegalArgumentException(s"""Timeout length must not be negative, question not sent to [$actorSel]. Sender[$sender] sent the message of type "${message.getClass.getName}"."""))
|
||||
new IllegalArgumentException(s"""Timeout length must be positive, question not sent to [$actorSel]. Sender[$sender] sent the message of type "${message.getClass.getName}"."""))
|
||||
} else {
|
||||
val a = PromiseActorRef(ref.provider, timeout, targetName = actorSel, "unknown", sender)
|
||||
val message = messageFactory(a)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ object AskPattern {
|
|||
case ref: InternalActorRef ⇒
|
||||
if (timeout.duration.length <= 0)
|
||||
(ActorRef[U](ref.provider.deadLetters),
|
||||
Future.failed[U](new IllegalArgumentException(s"Timeout length must not be negative, question not sent to [$actorRef]")))
|
||||
Future.failed[U](new IllegalArgumentException(s"Timeout length must be positive, question not sent to [$actorRef]")))
|
||||
else {
|
||||
val a = PromiseActorRef(ref.provider, timeout, actorRef, "unknown")
|
||||
val b = ActorRef[U](a)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue