use of org.infinispan.commands.functional.TxReadOnlyManyCommand in project infinispan by infinispan.
the class CallInterceptor method visitReadOnlyManyCommand.
@Override
public Object visitReadOnlyManyCommand(InvocationContext ctx, ReadOnlyManyCommand command) throws Throwable {
if (command instanceof TxReadOnlyManyCommand) {
TxReadOnlyManyCommand txReadOnlyManyCommand = (TxReadOnlyManyCommand) command;
List<List<Mutation>> mutations = txReadOnlyManyCommand.getMutations();
if (mutations != null && !mutations.isEmpty()) {
return visitTxReadOnlyCommand(ctx, (TxReadOnlyManyCommand) command, mutations);
}
}
Collection<?> keys = command.getKeys();
// lazy execution triggers exceptions on unexpected places
ArrayList<Object> retvals = new ArrayList<>(keys.size());
boolean skipStats = Param.StatisticsMode.isSkip(command.getParams());
DataConversion keyDataConversion = command.getKeyDataConversion();
DataConversion valueDataConversion = command.getValueDataConversion();
Function function = command.getFunction();
for (Object k : keys) {
CacheEntry me = ctx.lookupEntry(k);
EntryView.ReadEntryView view = me.isNull() ? EntryViews.noValue(k, keyDataConversion) : EntryViews.readOnly(me, keyDataConversion, valueDataConversion);
Object ret = snapshot(function.apply(view));
retvals.add(skipStats ? ret : StatsEnvelope.create(ret, me.isNull()));
}
return retvals.stream();
}
Aggregations