title: How to get stack trace of a thread
body: <p>I have a multithreaded application. Several messages are coming to the application and are processed in separated threads. For this I am using classes ThreadPoolExecutor and FutureTask from package java.util.concurrent.</p>
  
  <p>Occasionally I have some deadlocks in the application. When a deadlock occurs I want to interrupt the blocking thread and I want to log the stack trace of this thread so that I can later resolve the deadlock.</p>
  
  <p>Is there any way how can we find the stack trace of a thread outside of that thread in Java?</p>