title: Kill a stuck thread on a running VM (JBoss Instance) in Java?
body: <p>A <a href="https://issues.apache.org/jira/browse/PDFBOX-537" rel="nofollow noreferrer">bug in a third party library</a> is causing an infinite loop in a worker thread on a JBoss instance of mine.  Do you know of a way to kill this "stuck" thread without restarting the server?  We'd like to be able to recover from this  until a fix is deployed, preferably without having to restart.</p>
  
  <p>I've seen a few people <a href="https://stackoverflow.com/questions/3130701/killing-a-running-thread-in-java">mention using Thread.interrupt()</a> - if I were to code my own MBean, how would I get a handle to the thread in question in order to interrupt it?</p>
  
  <p><strong>Update:</strong> Wasn't able to solve using any of these methods.  I did come across <a href="https://community.jboss.org/thread/51838" rel="nofollow noreferrer">another thread about the same issue</a> that had a link to why <a href="http://docs.oracle.com/javase/1.4.2/docs/guide/misc/threadPrimitiveDeprecation.html" rel="nofollow noreferrer">Thread.stop() is deprecated</a>. Someone else has <a href="https://stackoverflow.com/questions/5660097/stopping-destroying-a-thread/">asked a similar question</a> with similar results. It seems like more sophisticated containers should provide this kind of health mechanism, but I guess their hands are tied w/r/t the JVM.  </p>