in jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/cxf/PromiseAwareJAXRSInvoker.java [35:54]
protected AsyncResponseImpl checkFutureResponse(Message inMessage, Object result) {
if (inMessage == null || result == null) {
return null;
}
// Fast path - do they share our view of the Promise
if (result instanceof Promise) {
return handlePromise(inMessage, (Promise<?>) result);
}
// Slower check, is it a Promise?
final Class<?> clazz = result.getClass();
if (promises.computeIfAbsent(clazz, type -> Arrays.stream(type.getInterfaces())
.map(Class::getName)
.anyMatch("org.osgi.util.promise.Promise"::equals))) {
return handlePromiseFromAnotherClassSpace(inMessage, result, clazz);
}
return super.checkFutureResponse(inMessage, result);
}