Search in sources :

Example 1 with UnsuccessfulResponse

use of org.infinispan.remoting.responses.UnsuccessfulResponse in project infinispan by infinispan.

the class ScatteredDistributionInterceptor method handleWritePrimaryResponse.

private Object handleWritePrimaryResponse(InvocationContext ctx, DataWriteCommand command, Object rv) {
    Response response = (Response) rv;
    if (!response.isSuccessful()) {
        command.fail();
        if (response instanceof UnsuccessfulResponse) {
            return ((UnsuccessfulResponse) response).getResponseValue();
        } else {
            throw new CacheException("Unexpected response " + response);
        }
    }
    Object responseValue = ((SuccessfulResponse) response).getResponseValue();
    try {
        return command.acceptVisitor(ctx, new PrimaryResponseHandler(responseValue));
    } catch (Throwable throwable) {
        throw CompletableFutures.asCompletionException(throwable);
    }
}
Also used : CacheNotFoundResponse(org.infinispan.remoting.responses.CacheNotFoundResponse) UnsuccessfulResponse(org.infinispan.remoting.responses.UnsuccessfulResponse) SuccessfulResponse(org.infinispan.remoting.responses.SuccessfulResponse) ExceptionResponse(org.infinispan.remoting.responses.ExceptionResponse) ValidResponse(org.infinispan.remoting.responses.ValidResponse) UnsureResponse(org.infinispan.remoting.responses.UnsureResponse) Response(org.infinispan.remoting.responses.Response) SuccessfulResponse(org.infinispan.remoting.responses.SuccessfulResponse) CacheException(org.infinispan.commons.CacheException) UnsuccessfulResponse(org.infinispan.remoting.responses.UnsuccessfulResponse)

Aggregations

CacheException (org.infinispan.commons.CacheException)1 CacheNotFoundResponse (org.infinispan.remoting.responses.CacheNotFoundResponse)1 ExceptionResponse (org.infinispan.remoting.responses.ExceptionResponse)1 Response (org.infinispan.remoting.responses.Response)1 SuccessfulResponse (org.infinispan.remoting.responses.SuccessfulResponse)1 UnsuccessfulResponse (org.infinispan.remoting.responses.UnsuccessfulResponse)1 UnsureResponse (org.infinispan.remoting.responses.UnsureResponse)1 ValidResponse (org.infinispan.remoting.responses.ValidResponse)1