Search in sources :

Example 1 with ExceptionSyncInvocationStage

use of org.infinispan.interceptors.ExceptionSyncInvocationStage in project infinispan by infinispan.

the class TriangleDistributionInterceptor method invokeNextWriteManyKeysInPrimary.

private <C extends WriteCommand> Object invokeNextWriteManyKeysInPrimary(InvocationContext ctx, C command, Set<Object> keys, LocalizedCacheTopology cacheTopology, SubsetCommandCopy<C> commandCopy, MultiKeyBackupBuilder<C> backupBuilder) {
    try {
        sendToBackups(command, keys, cacheTopology, backupBuilder);
        final VisitableCommand.LoadType loadType = command.loadType();
        C primaryCmd = commandCopy.copySubset(command, keys);
        return asyncInvokeNext(ctx, primaryCmd, checkRemoteGetIfNeeded(ctx, primaryCmd, keys, cacheTopology, loadType == PRIMARY || loadType == OWNER));
    } catch (Throwable t) {
        // Wrap marshalling exception in an invocation stage
        return new ExceptionSyncInvocationStage(t);
    }
}
Also used : VisitableCommand(org.infinispan.commands.VisitableCommand) ExceptionSyncInvocationStage(org.infinispan.interceptors.ExceptionSyncInvocationStage)

Example 2 with ExceptionSyncInvocationStage

use of org.infinispan.interceptors.ExceptionSyncInvocationStage in project infinispan by infinispan.

the class SimpleAsyncInvocationStage method addCallback.

@Override
public <C extends VisitableCommand> Object addCallback(InvocationContext ctx, C command, InvocationCallback<C> function) {
    if (future.isDone()) {
        Object rv;
        Throwable throwable;
        try {
            rv = future.getNow(null);
            throwable = null;
        } catch (Throwable t) {
            rv = null;
            throwable = CompletableFutures.extractException(t);
        }
        try {
            return function.apply(ctx, command, rv, throwable);
        } catch (Throwable t) {
            return new ExceptionSyncInvocationStage(t);
        }
    }
    return new QueueAsyncInvocationStage(ctx, command, future, function);
}
Also used : ExceptionSyncInvocationStage(org.infinispan.interceptors.ExceptionSyncInvocationStage)

Example 3 with ExceptionSyncInvocationStage

use of org.infinispan.interceptors.ExceptionSyncInvocationStage in project infinispan by infinispan.

the class QueueAsyncInvocationStage method invokeDirectly.

private Object invokeDirectly(InvocationContext ctx, VisitableCommand command, InvocationCallback function) {
    Object rv;
    Throwable throwable;
    try {
        rv = future.join();
        throwable = null;
    } catch (Throwable t) {
        rv = null;
        throwable = CompletableFutures.extractException(t);
    }
    try {
        return function.apply(ctx, command, rv, throwable);
    } catch (Throwable t) {
        return new ExceptionSyncInvocationStage(t);
    }
}
Also used : ExceptionSyncInvocationStage(org.infinispan.interceptors.ExceptionSyncInvocationStage)

Aggregations

ExceptionSyncInvocationStage (org.infinispan.interceptors.ExceptionSyncInvocationStage)3 VisitableCommand (org.infinispan.commands.VisitableCommand)1