+act #15284 Add throws TimeoutException to Inbox.receive

(cherry picked from commit ab19cc8a527f1a01a8180c2b199affcb47e5b1d2)
This commit is contained in:
Patrik Nordwall 2014-06-25 17:08:28 +02:00
parent d225149a96
commit 3a94510869
3 changed files with 40 additions and 2 deletions

View file

@ -38,7 +38,11 @@ public class InboxDocTest {
probe.expectMsgEquals("hello");
probe.send(probe.getLastSender(), "world");
//#inbox
assert inbox.receive(Duration.create(1, TimeUnit.SECONDS)).equals("world");
try {
assert inbox.receive(Duration.create(1, TimeUnit.SECONDS)).equals("world");
} catch (java.util.concurrent.TimeoutException e) {
// timeout
}
//#inbox
}
@ -50,7 +54,11 @@ public class InboxDocTest {
final Inbox inbox = Inbox.create(system);
inbox.watch(target);
target.tell(PoisonPill.getInstance(), ActorRef.noSender());
assert inbox.receive(Duration.create(1, TimeUnit.SECONDS)) instanceof Terminated;
try {
assert inbox.receive(Duration.create(1, TimeUnit.SECONDS)) instanceof Terminated;
} catch (java.util.concurrent.TimeoutException e) {
// timeout
}
//#watch
}