Merge pull request #15465 from akka/wip-15284-throws-annotation-master-patriknw
+act #15284 Add throws TimeoutException to Inbox.receive
This commit is contained in:
commit
018e0c33b5
3 changed files with 40 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue