jakartaee / jakartaee/servlet

ServletRequestListener methods and Threads

Open
#120 5 comments 0 reactions 1 assignee Claimed by @glassfishrobot View on GitHub
Dominant language
Java
Stars
325
Forks
112
PR merge metrics
No merged PRs in 30d

Description

> JH> Dear Servlet experts,
> JH> the behavior of **javax.servlet.ServletRequestListener** seems to be
> JH> underspecified in Servlet 3.1 especially in case of asynchronous
> JH> requests. I am seeking clarification for the case that follows.
>
> JH> There two properties of ServletRequestListener invocation that a Servlet
> JH> implementation may want to have:
>
> JH> 1) requestInitialized()/requestDestroyed() are only called once per request
>
> JH> This one simply says that the pair of
> JH> requestInitialized()/requestDestroyed() methods of a given listener is
> JH> not called more than once per a given request.
>
> JH> 2) Symmetry with respect to the calling thread
>
> JH> This property says that if the
> JH> ServletRequestListener.requestInitialized() is called by a given thread
> JH> (T1) then the corresponding ServletRequestListener.requestDestroyed()
> JH> invocation is performed by the same thread (T1). This second property is
> JH> very important for integration with various other
> JH> frameworks/technologies as it allows them to set a ThreadLocal in
> JH> requestInitialized() and remove it in requestDestroyed()
>
> JH> Both these properties are achievable at the same time for synchronous
> JH> Servlets. However, for asynchronous Servlets these properties are
> JH> mutually exclusive. Most Servlet containers deal with this by
> JH> sacrificing property (1) and only guarantee (2).
>
> JH> I do not find the specification clear enough to tell which of the two
> JH> options is the correct one.

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.