Hi Ulhas,

Thanks for your last post.

I've removed the Bus creation to a static member of the Handler class I am
using.  I've got a monitor thread which kicks in every 2 minutes and acts as
a heartbeat to a WS.  This basically boils down to creating a new instance
of the following class and then calling 'process' :

public class WSEnabledHandler {
  private static Bus bus = null;
  private IDSWSPortType webService = null;

  public void process() {
     createPortService();

    // call the WS
    webService.authenticate();

    endProcess();
  }

  private void createPortService() {
        if(bus == null) {
                bus = BusFactory.newInstance().createBus();
                BusFactory.setDefaultBus(bus);
                BusFactory.setThreadDefaultBus(bus); 
        }
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setBus(bus);
        factory.setServiceClass(IDSWSPortType.class);
        factory.setAddress(wsConfig.getWSDLUrl());
        webService = (IDSWSPortType) factory.create();
        
        // turn chunking off
        Client client = ClientProxy.getClient(webService);
        HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
        httpClientPolicy.setAllowChunking(false);
        httpConduit.setClient(httpClientPolicy);
  }
  private void endProcess() {
        // does nothing, but should it?
  }
}

I'm getting a slow leak on memory - roughly 0.7Mb per call.  With this
background thread, together with user activity (which does similar to
above), we're quite quickly running out of memory.  Do I need to do anything
to explicitly release resources tied up in the JaxWsProxyFactoryBean or
Client?

Regards

Matt
-- 
View this message in context: 
http://www.nabble.com/Resource-management-and-cleanup-tp19644012p19955118.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to