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

Alessio Soldano commented on CXF-6826:
--------------------------------------

Thanks for the feedback Sergey.
Two comments:
1) the idea of having a non-static map could be good, but the 
MediaTypeHeaderProvider is statically accessed from the JAXRSUtils (for 
instance I've seen it being heavily invoked from 
ProviderFactory.matchesWriterCriterias(...) -> 
JAXRSUtils.getProviderProduceTypes(MessageBodyWriter<?> provider), it doesn't 
seem to me the RuntimeDelegateImpl is involved in that case
2) wiping out the concurrent map after it reaches a given size should be easy 
(but unfair, I'd say), evicting stuff from a deque or use a circular buffer 
would have the drawback of slowing the get, right?

> Cache MediaTypeHeaderProvider.valueOf(String mType) results
> -----------------------------------------------------------
>
>                 Key: CXF-6826
>                 URL: https://issues.apache.org/jira/browse/CXF-6826
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>            Reporter: Alessio Soldano
>
> MediaTypeHeaderProvider.valueOf(String mType) ends up being called a lot with 
> the same parameter values, as those are basically the contents of the 
> @Produce annotations on resources. Each request ends up into the same 
> invocation, which is cpu and memory intensive.
> It might make sense to add a map in the MediaTypeHeaderProvider to store the 
> result of the static valueOf method invocation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to