use of org.opendaylight.controller.cluster.raft.client.messages.OnDemandRaftState in project controller by opendaylight.
the class MemberNode method verifyRaftState.
public static void verifyRaftState(final AbstractDataStore datastore, final String shardName, final RaftStateVerifier verifier) throws Exception {
ActorContext actorContext = datastore.getActorContext();
Future<ActorRef> future = actorContext.findLocalShardAsync(shardName);
ActorRef shardActor = Await.result(future, Duration.create(10, TimeUnit.SECONDS));
AssertionError lastError = null;
Stopwatch sw = Stopwatch.createStarted();
while (sw.elapsed(TimeUnit.SECONDS) <= 5) {
OnDemandRaftState raftState = (OnDemandRaftState) actorContext.executeOperation(shardActor, GetOnDemandRaftState.INSTANCE);
try {
verifier.verify(raftState);
return;
} catch (AssertionError e) {
lastError = e;
Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
}
}
throw lastError;
}
Aggregations