use of org.infinispan.interceptors.InvocationStage in project infinispan by infinispan.
the class CacheMgmtInterceptorTest method testVisitPutMapCommandException.
public void testVisitPutMapCommandException() throws Throwable {
PutMapCommand command = new PutMapCommand(Collections.singletonMap(KEY, VALUE), null, 0, null);
InvocationStage stage = makeStage(interceptor.visitPutMapCommand(ctx, command));
assertFalse(stage.isDone());
timeService.advance(1);
nextInterceptor.completeLastInvocationExceptionally(new TestException());
expectInvocationException(stage);
assertEquals(1, interceptor.getAverageWriteTime());
}
use of org.infinispan.interceptors.InvocationStage in project infinispan by infinispan.
the class CacheMgmtInterceptorTest method testVisitGetAllCommandException.
public void testVisitGetAllCommandException() throws Throwable {
GetAllCommand command = new GetAllCommand(Collections.singleton(KEY), 0, false);
InvocationStage stage = makeStage(interceptor.visitGetAllCommand(ctx, command));
assertFalse(stage.isDone());
timeService.advance(1);
nextInterceptor.completeLastInvocationExceptionally(new TestException());
expectInvocationException(stage);
assertEquals(1, interceptor.getAverageReadTime());
}
use of org.infinispan.interceptors.InvocationStage in project infinispan by infinispan.
the class CacheMgmtInterceptorTest method testVisitGetCacheEntryCommandException.
public void testVisitGetCacheEntryCommandException() throws Throwable {
GetCacheEntryCommand command = new GetCacheEntryCommand(KEY, 0, 0);
InvocationStage stage = makeStage(interceptor.visitGetCacheEntryCommand(ctx, command));
assertFalse(stage.isDone());
timeService.advance(1);
nextInterceptor.completeLastInvocationExceptionally(new TestException());
expectInvocationException(stage);
assertEquals(1, interceptor.getAverageReadTime());
}
use of org.infinispan.interceptors.InvocationStage in project infinispan by infinispan.
the class CacheMgmtInterceptorTest method testVisitGetKeyValueCommandException.
public void testVisitGetKeyValueCommandException() throws Throwable {
GetKeyValueCommand command = new GetKeyValueCommand(KEY, 0, 0);
InvocationStage stage = makeStage(interceptor.visitGetKeyValueCommand(ctx, command));
assertFalse(stage.isDone());
timeService.advance(1);
nextInterceptor.completeLastInvocationExceptionally(new TestException());
expectInvocationException(stage);
assertEquals(1, interceptor.getAverageReadTime());
}
use of org.infinispan.interceptors.InvocationStage in project infinispan by infinispan.
the class QueueAsyncInvocationStage method invokeQueuedHandlers.
private void invokeQueuedHandlers(Object rv, Throwable throwable) {
if (log.isTraceEnabled())
log.tracef("Resuming invocation of command %s with %d handlers", command, queueSize());
while (true) {
InvocationCallback function = queuePoll();
if (function == null) {
// We finished running the handlers, and the last pollHandler() call locked the queue.
if (throwable == null) {
future.complete(rv);
} else {
future.completeExceptionally(throwable);
}
return;
}
// Run the handler
try {
if (throwable != null) {
throwable = CompletableFutures.extractException(throwable);
}
rv = function.apply(ctx, command, rv, throwable);
throwable = null;
} catch (Throwable t) {
rv = null;
throwable = t;
}
if (rv instanceof InvocationStage) {
InvocationStage currentStage = (InvocationStage) rv;
currentStage.addCallback(ctx, command, this);
return;
}
// We got a synchronous invocation stage, continue with the next handler
}
}
Aggregations