How to shutdown down cxf bus service explicitly ?
Issue
- As recommended by RedHat the convention to clear cxf from heap, any coding parts connecting to web service should shutdown the Bus Service in finally block as shown below
try {
Service service = Service.create(wsdlURL, serviceQName);
MyEndpoint port = service.getPort(MyEndpoint.class);
//...
} finally {
Bus bus = BusFactory.getThreadDefaultBus(false);
if (bus != null)
bus.shutdown(true);
}
- However, during POC, we found that the Bus object is null every times getting default Bus
Bus bus = BusFactory.getThreadDefaultBus(false);
-
We then do not certain that if we put this bus shutdown to our web service coding parts, it will really help clear the cxf.
Could you please help clarify when the Bus object is not null and when it is null, and shutting down the Bus object really
help clear cxf from heap. -
As every time the thread default bus is null, we wonder why there are CXF thread pending in the java heap unable to be garbage-collected.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
- Apache CXF
- JBossWS-CXF
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.