<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="EN-US" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal">Hi,</p><p class="MsoNormal"> </p><p class="MsoNormal">I built a web application that connects to Freeswitch using the org.freeswitch.esl.client.Client. I connect the Client object from a Spring annotated service that I call from a Spring controller. I put the connected client in my ServletContext, so I can access it later to call client.cancelEventSubscriptions() and client.close() from my ServletContextListener contextDestroyed method when Tomcat is shutting down.</p>
<p class="MsoNormal"> </p><p class="MsoNormal">The problem I'm having is that even after I call close on the client, there are still a bunch of active threads that the client has spawned in the background. These threads are causing Tomcat to hang when I'm shutting down. Can anyone suggest an approach that would enable my application to disconnect the Freeswitch client when Tomcat is shutting down that would allow Tomcat to shutdown gracefully?</p>
<p class="MsoNormal"> </p><p class="MsoNormal">Below are errors from my Tomcat log for the threads that I have identified as being related to the Freeswitch client. I don't know how I can get to these threads to interrupt them and Client.close() seems to leave them hanging.</p>
<p class="MsoNormal"> </p><p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-1] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-3-thread-1] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-4-thread-1] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-2] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-3] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-4] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-5] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-6] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-7] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-8] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-9] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-10] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-11] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-12] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-13] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-14] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-15] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads</p><p class="MsoNormal">SEVERE: The web application [/socketspy] appears to have started a thread named [pool-5-thread-16] but has failed to stop it. This is very likely to create a memory leak.</p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks</p><p class="MsoNormal">SEVERE: The web application [/socketspy] created a ThreadLocal with key of type [org.jboss.netty.util.internal.ThreadLocalBoolean] (value [org.jboss.netty.util.internal.ThreadLocalBoolean@186e192]) and a value of type [java.lang.Boolean] (value [false]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. </p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks</p><p class="MsoNormal">SEVERE: The web application [/socketspy] created a ThreadLocal with key of type [org.jboss.netty.util.CharsetUtil$1] (value [org.jboss.netty.util.CharsetUtil$1@14d8e1]) and a value of type [java.util.IdentityHashMap] (value [{windows-1252=sun.nio.cs.MS1252$Encoder@373f86}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. </p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks</p><p class="MsoNormal">SEVERE: The web application [/socketspy] created a ThreadLocal with key of type [org.jboss.netty.util.internal.ThreadLocalRandom$1] (value [org.jboss.netty.util.internal.ThreadLocalRandom$1@12bb519]) and a value of type [org.jboss.netty.util.internal.ThreadLocalRandom] (value [org.jboss.netty.util.internal.ThreadLocalRandom@7e9dbc]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. </p>
<p class="MsoNormal">Dec 16, 2011 12:04:59 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks</p><p class="MsoNormal">SEVERE: The web application [/socketspy] created a ThreadLocal with key of type [org.jboss.netty.util.CharsetUtil$1] (value [org.jboss.netty.util.CharsetUtil$1@14d8e1]) and a value of type [java.util.IdentityHashMap] (value [{windows-1252=sun.nio.cs.MS1252$Encoder@a5b041}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. </p>
<p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal">Thanks,</p><p class="MsoNormal"> </p><p class="MsoNormal">Neil Davis</p></div></body></html>