users@jersey.java.net

Simplification of Injectable by using ThreadLocal

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 21 Oct 2008 12:57:33 +0200

Hi,

The Injectable interface is as follows:

     public interface Injectable<T> {
         T getValue(HttpContext context);
     }

it pulls in HttpContext thus a whole bunch of other stuff in the
jersey-core that is not really required.

It would be better if it was like this:

     public interface Injectable<T> {
         T getValue();
     }

But this requires that per-request based injectable providers, like
for @QueryParam have access to and use the ThreadLocal<HttpContext>
instance, instead of accessing the HttpContext instance passed to the
getValue method.

Is this a performance concern i should be worried about? Anyone else
have any experience with ThreadLocal?

Paul.