use of org.infinispan.commands.remote.GetKeysInGroupCommand in project infinispan by infinispan.
the class BaseDistributionInterceptor method visitGetKeysInGroupCommand.
@Override
public final Object visitGetKeysInGroupCommand(InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable {
if (command.isGroupOwner()) {
// don't go remote if we are an owner.
return invokeNext(ctx, command);
}
Address primaryOwner = distributionManager.getCacheTopology().getDistribution(command.getGroupName()).primary();
CompletionStage<ValidResponse> future = rpcManager.invokeCommand(primaryOwner, command, SingleResponseCollector.validOnly(), rpcManager.getSyncRpcOptions());
return asyncInvokeNext(ctx, command, future.thenAccept(response -> {
if (response instanceof SuccessfulResponse) {
// noinspection unchecked
List<CacheEntry> cacheEntries = (List<CacheEntry>) response.getResponseValue();
for (CacheEntry entry : cacheEntries) {
wrapRemoteEntry(ctx, entry.getKey(), entry, false);
}
}
}));
}
Aggregations