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

Sergey Beryozkin commented on CXF-6837:
---------------------------------------

Looks like we do not understand each other, may be it is my fault. 

Let me try again. The point of the cache that when CXF has, say,
{code:java}
@POST
@Consumes("application/json")
public Response post(List<A> data) {}
{code}

and it needs to select MessageBodyReader for List of A, it looks up the cache 
and gets MessageBodyReader for List of A immediately (i.e, no repeated generic 
types are checked) and then it only does isReadable(), and then 
MessageBodyReader for List of A reads the data, believing it must return List 
of A. At the moment the cache uses a 'List' + MediaType key to store a reader 
for List of A.

Next List of B comes in. So the reader for List of B is checked and added to 
the cache using only 'List' and MediaType therefore losing a List of A record. 
Now List of A is needed, we check the cache, we get a provider keyed by 'List' 
and MediaType, and ask it to read List A - but the provider is written to 
return a List of B.

Where is my logic above failing ?

 



> Add cache for MessageBodyReader/Writer
> --------------------------------------
>
>                 Key: CXF-6837
>                 URL: https://issues.apache.org/jira/browse/CXF-6837
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 3.1.5, 3.0.8
>         Environment: windows
>            Reporter: Neal Hu
>             Fix For: 3.2.0
>
>         Attachments: ProviderCache.java, ProviderFactory.patch
>
>
> CXF selects the msgBodyReader/writer in the reader/writer list for every 
> request, which has big impact to the performance. Jersey also has the cache 
> in 
> org.glassfish.jersey.message.internal.MessageBodyFactory._getMessageBodyReader(...).
>  I have tried add the cache for CXF in ProviderFactory and been proved that 
> it has improved 7-8% for json requests in JMeter. Please let me know if you'd 
> like me to add the enhancement for CXF. Thanks. 
> http://cxf.547215.n5.nabble.com/MessageBodyReader-Writer-cache-td5767091.html



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

Reply via email to