cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Caching MessageFactory instances
Date Tue, 21 Apr 2009 03:06:42 GMT
On Mon April 20 2009 10:43:53 pm Kevin Conaway wrote:
> MessageFactory#newInstance() turns out to be an expensive operation when
> used in an environment with a lot of dynamic dispatch calls.  It is called
> once for the outgoing request and the incoming response (or vice versa).

I was wondering how expensive those factory calls were.   I know we cache the 
factories for the Stax stuff.

> Is it possible for the DispatchInDatabindingInterceptor and
> DispatchOutDatabindingInterceptor to cache or reuse MessageFactory
> instances instead of creating them every time?  I understand that these
> Interceptors are created by DispatchImpl with each call so perhaps the
> DispatchImpl could provide MessageFactory implementations for these
> classes.

Well, I guess there are two ways to approach this....

1) Yes, it probably can be cached.   A patch would be nice.  

2) It really won't matter real soon as the DispatchXXXDatabindingInterceptor 
is going away.   With 2.2.1, it will already NOT be used for the Dispatch 
clients.  (thus, they will be completely mis-named)   They'll only be used on 
for the Provider based services on the server side.   

As part of https://issues.apache.org/jira/browse/CXF-1907 the 
Dispatch/Provider stuff is being complete re-written to  use the same 
internals as normal clients/servers wherever possible.   The interceptor 
chains will end up being almost identical.     For 2.2.1, only the Dispatch 
stuff is there.   Hopefully for 2.2.2, the provider side will as well.

That said, if an SAAJ model IS needed, it would go through the 
SAAJIn/OutInterceptor which SHOULD also do the same factory caching.   I'll go 
ahead and update those interceptors to do that.   That should benefit a bunch 
of scenarios (like all the WS-Security stuff).

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message