Thank you, that seems to do the trick, although I believe the first line is actually:
BusFactory.newInstance().createBus();

--Joe

On Sep 10, 2007, at 10:12 PM, Willem Jiang wrote:

Hi Joe,

Yes, you could set a bus to all your port, but you need write some no JAX-WS compatible codes.

Here is a code snippet for setting the default bus for all the thread

Bus bus = BusFactory.createBus();
// in you working thread start up
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
// then just use the JAX-WS API to get the port.

Please see my other comments in the mail.

Joe Sunday wrote:
Reading through that I'm still not clear.. Is the bus associated to the running JVM and shared for all ports, or is it per-port?

To rephrase back to my actual problem, which is painfully high memory usage when trying to talk to a complex endpoint where the WSDL is just under a meg, particularly when used against multiple endpoints from multiple threads.

1) Is it safe to use a single port from multiple threads concurrently?
I don't think so.
2) Is it safe to use multiple ports to different endpoints within a thread concurrently?
It should be safe.
3) Is bus shutdown the proper way to free the 20 MB or so per thread/port when I'm done with a port (but not done using CXF in my application)
It is no need for us the shutdown the bus per port invocation , because it will take a long time to load a bus.
4) Is there any way CXF can re-use all or some of the service model objects it builds from a WSDL the next time I bind it against a different endpoint? It seems like 98% of that 20 MB model should be the same objects every time.
The bus holds the reference of WSDL manager which holds the WSDL definitions which will eat up lots of memory for big wsdl file. If we share a same bus with all the ports, I think the memory consumption will be a low level.

Reply via email to