- private static ABIVersion toABIVersion(final short version) {
- switch (version) {
- case DataStoreVersions.BORON_VERSION:
- return ABIVersion.BORON;
- }
+ FutureConverters.toJava(actorContext.findPrimaryShardAsync(shardName)).thenCompose(info -> {
+ LOG.debug("Looking up primary info for {} from {}", shardName, info);
+ return FutureConverters.toJava(Patterns.ask(info.getPrimaryShardActor(),
+ (Function<ActorRef, Object>) replyTo -> new ConnectClientRequest(null, replyTo,
+ ABIVersion.BORON, ABIVersion.current()), DEAD_TIMEOUT));
+ }).thenApply(response -> {
+ if (response instanceof RequestFailure) {
+ final RequestFailure<?, ?> failure = (RequestFailure<?, ?>) response;
+ LOG.debug("Connect request failed {}", failure, failure.getCause());
+ throw Throwables.propagate(failure.getCause());
+ }