eclipse-ee4j / eclipse-ee4j/jersey

Asynchronous ContainerRequestFilter using ManagedAsync

Open
#2,596 8 comments 0 reactions 0 assignees View on GitHub
async Component: core filter Priority: Major Type: New Feature
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

A ContainerRequestFilter cannot be executed asynchronously.

A very common use case for this filter would be an authorization check, but if that check goes to an external service or to a database, benefits from @ManagedAsync are lost because only resource methods are invoked asynchronously.

This is very tricky because a PreMatching filter could change the request from a @ManagedAsync resource method to a non-async method, or visa-versa. Maybe any filters that are not PreMatching should be offloaded to the ExecutorService if the matching resource method has @ManagedAsync? Or maybe an entirely new type of filter should be introduced for this case, one that's basically an HK2 AOP MethodInterceptor?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.