Hi,

Has anyone looked at caching JAXBContexts on a per jaxws service basis?

I have been looking at the cpu profile of calls to
org.apache.cxf.jaxws.ServiceImpl.createPort()

The bulk of the work is split between two tasks, building the
JAXBBContext and building the XmlSchemaCollection from the wsdl model.

In an application that makes many calls to getPort()/createPort() it may
make sense to cache both of these. 

The XMLSchemaCollection is very much part of the WSDL Definition so a
cache of the schemas could be something a  JAXB specific/aware
WSDLManager could maintain. 


The JAXBContext is a little more complex because of the variety of entry
points to it's creation.

As an experiment, I splashed a static cache into
JAXBDataBinding.initialize() based on Service QName. Initial results
were great for my simple test case but the CodeFirstTest showed up the
error in my ways as it builds a context from a class rather than a
complete wsdl model. Caching on interface class gives better results.

A static cache will not be a winner, some one of bus or ServiceImpl will
need to manage the cache or reuse factory beans but there is no clear
owner of the process that results in JAXBContext creation.

Before I look more into this I want to know if anyone has looked into
caching JAXBContexts or has any ideas?

Thanks in advance,
Gary.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to