cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-3379) @Context fails to inject Application instance
Date Tue, 08 Mar 2011 11:33:59 GMT

    [ https://issues.apache.org/jira/browse/CXF-3379?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003901#comment-13003901
] 

Sergey Beryozkin commented on CXF-3379:
---------------------------------------

Hi Ben

m.getExchange() != null

is most likely (99%) a lame attempt to avoid initializing Messages in tests. It is most likely
a dead code.
I can see now few tests failing with NPEs without this check because I just pass new MessageImpl().
But I'd keep it anyway, just to feel safer :-) - so yes, please keep the null guard in your
patch too, sorry...

About Applications and singletons.

Do we have the proper visibility guarantee if we have a singleton root resource class injected
the same Application reference on every request across multiple threads ? Is field injection
an atomic operation at the low level ? So say the thread1 injects the Application reference
and then just before it attempts to read this field from the application code another thread2
assigns the same reference to that field. Is there a chance the thread1 will see a corrupted
reference or null, not sure - need to review the basics... 

Not an issue for per-request resource classes though...


> @Context fails to inject Application instance
> ---------------------------------------------
>
>                 Key: CXF-3379
>                 URL: https://issues.apache.org/jira/browse/CXF-3379
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.3
>            Reporter: Ben Noordhuis
>
> Quoting JSR 311:
> "The instance of the application-supplied Application subclass can be injected into a
class field or method parameter using the @Context annotation. Access to the Application subclass
instance allows configuration information to be centralized in that class. Note that this
cannot be injected into the Application subclass itself since this would create a circular
dependency."
> JAXRSUtils.createContextValue() doesn't handle this. This bug exists in 2.3.x and HEAD.
> I'd submit a patch but I don't know where (or if) the Application class is registered
after it's instantiated by CXFNonSpringJaxrsServlet.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message