@SuppressWarnings("unchecked")
protected Object callFuture(AbstractAsyncProxyRemoteCall call, @SuppressWarnings("rawtypes") Class returnType) {
// If the result value is a CompletableFuture then
// we callCompletableAsync
if (CompletableFuture.class.isAssignableFrom(returnType)) {
@SuppressWarnings("rawtypes")
CompletableFuture result = new CompletableFuture();
callCompletableAsync(call, (r,hadException,exception) -> {
if (hadException) result.completeExceptionally(exception);
else result.complete(r);
});
// And return the CompletableFuture
return result;
}
// Else if it's an IFuture then return