You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "David Liu (JIRA)" <ji...@apache.org> on 2011/06/24 09:12:47 UTC

[jira] [Commented] (CXF-3614) Thread leak in WorkQueueManagerImpl and AutomaticWorkQueueImpl when we use it in tomcat

    [ https://issues.apache.org/jira/browse/CXF-3614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054277#comment-13054277 ] 

David Liu commented on CXF-3614:
--------------------------------

Thanks Willem.

David

> 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
>            Assignee: Willem Jiang
>             Fix For: 2.3.6, 2.4.2, 2.5
>
>
> 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