use of com.hazelcast.core.IndeterminateOperationState in project hazelcast by hazelcast.
the class InvocationFuture method resolve.
@SuppressWarnings({ "checkstyle:npathcomplexity", "checkstyle:cyclomaticcomplexity" })
@Override
protected Object resolve(Object unresolved) {
if (unresolved == null) {
return null;
} else if (unresolved == INTERRUPTED) {
return new ExceptionalResult(new InterruptedException(invocation.op.getClass().getSimpleName() + " was interrupted. " + invocation));
} else if (unresolved == CALL_TIMEOUT) {
return new ExceptionalResult(newOperationTimeoutException(false));
} else if (unresolved == HEARTBEAT_TIMEOUT) {
return new ExceptionalResult(newOperationTimeoutException(true));
} else if (unresolved.getClass() == Packet.class) {
NormalResponse response = invocation.context.serializationService.toObject(unresolved);
unresolved = response.getValue();
}
Object value = unresolved;
if (deserialize && value instanceof Data) {
value = invocation.context.serializationService.toObject(value);
if (value == null) {
return null;
}
}
Throwable cause = (value instanceof ExceptionalResult) ? ((ExceptionalResult) value).getCause() : null;
if (invocation.shouldFailOnIndeterminateOperationState() && (value instanceof IndeterminateOperationState || cause instanceof IndeterminateOperationState)) {
value = wrapThrowable(new IndeterminateOperationStateException("indeterminate operation state", cause == null ? (Throwable) value : cause));
}
return value;
}
Aggregations