Thread leak in WorkQueueManagerImpl and AutomaticWorkQueueImpl when we use it 
in tomcat
---------------------------------------------------------------------------------------

                 Key: CXF-3614
                 URL: https://issues.apache.org/jira/browse/CXF-3614
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.4.1
            Reporter: David Liu


Hi,

  There is the threadleak in WorkQueueManagerImpl / AutomaticWorkQueueImpl when 
we use it in tomcat or other web container. In AutomaticWorkQueueImpl created 
by WorkQueueManagerImpl, it has a class WatchDog which is a daemon thread, If 
we call shutdown in WorkQueueManagerImpl, it only clean the queue in 
AutomaticWorkQueueImpl but it won't notify WatchDog thread, so the WatchDog 
will wait and live until we exit JVM.
  It won't cause issue if we run CXF as standalone app, however, it will cause 
thread leak in tomcat because we do not stop tomcat when we undeploy cxf 
web-app, so we cannot destroy WatchDog thread in this case.

  Could you please fix it? thanks.

{code}
public class MyWorkQueueManagerImpl extends WorkQueueManagerImpl implements 
DisposableBean {

    @Override
    public void destroy() throws Exception {
        this.shutdown(false);
        for (AutomaticWorkQueue queue : namedQueues.values()) {
            if (queue instanceof AutomaticWorkQueueImpl) {
                AutomaticWorkQueueImpl queueimpl = ((AutomaticWorkQueueImpl) 
queue);
                queueimpl.terminated();
                queueimpl.watchDog.interrupt();
            }
        }
    }
}
{code}

David

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to