private Object resolveAsync()

in provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/TcpServer.java [135:160]


    private Object resolveAsync(Object result) throws InterruptedException, Throwable {
        // exceptions are wrapped in an InvocationTargetException just like in a sync invoke
        if (result instanceof Future) {
            Future<Object> fu = (Future<Object>) result;
            try {
                result = fu.get();
            } catch (ExecutionException e) {
                throw new InvocationTargetException(e.getCause());
            }
        } else if (result instanceof CompletionStage) {
            CompletionStage<Object> fu = (CompletionStage<Object>) result;
            try {
                result = fu.toCompletableFuture().get();
            } catch (ExecutionException e) {
                throw new InvocationTargetException(e.getCause());
            }
        } else if (result instanceof Promise) {
            Promise<Object> fu = (Promise<Object>) result;
            try {
                result = fu.getValue();
            } catch (InvocationTargetException e) {
                throw e;
            }
        }
        return result;
    }