users@jersey.java.net

JAX-RS Specification and threading guarantees

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Fri, 23 Apr 2010 12:46:28 -0400

What guarantees regarding threads can be made about the interaction of
a MessageBodyWriter and a ContextResolver?

Specifically, is it (intended to be) guaranteed by the specification
that during writeTo() as handled by provider-supplied MBWs any
ContextResolvers that get invoked will be invoked on the same thread?

I would think this would have to be a guarantee, but I wanted to make sure.

Additionally, I have an MBW that is itself also a ContextResolver. I
note in the logs--happily--that only one instance of this class is
created. Is that something I can rely on, or are JAX-RS
implementations free to create one instance of my class for its
MessageBodyWriter role and one instance for its ContextResolver role?

Best,
Laird