FiniteDuration duration = Duration.create(100, TimeUnit.MILLISECONDS);
for(int i = 0; i < 20 * 5; i++) {
Future<Object> future = Patterns.ask(shard, new FindLeader(), new Timeout(duration));
try {
FindLeaderReply resp = (FindLeaderReply)Await.result(future, duration);
if(resp.getLeaderActor() != null) {
FiniteDuration duration = Duration.create(100, TimeUnit.MILLISECONDS);
for(int i = 0; i < 20 * 5; i++) {
Future<Object> future = Patterns.ask(shard, new FindLeader(), new Timeout(duration));
try {
FindLeaderReply resp = (FindLeaderReply)Await.result(future, duration);
if(resp.getLeaderActor() != null) {
for(int i = 0; i < 20 * 5; i++) {
Future<Object> future = Patterns.ask(shard, new FindLeader(), new Timeout(duration));
try {
for(int i = 0; i < 20 * 5; i++) {
Future<Object> future = Patterns.ask(shard, new FindLeader(), new Timeout(duration));
try {
- Assert.fail("Unexpected leader found for shard " + shard.path());
+ if(lastResponse instanceof Throwable) {
+ throw (AssertionError)new AssertionError(
+ String.format("Unexpected error occurred from FindLeader for shard %s", shard.path())).
+ initCause((Throwable)lastResponse);
+ }
+
+ Assert.fail(String.format("Unexpected leader %s found for shard %s", lastResponse, shard.path()));