code: public StringBuffer getStackTrace() {
  
  		Map<Thread, StackTraceElement[]> activeThreadStackTraces = Thread
  				.getAllStackTraces();
  		StringBuffer requestTheadStackStr = new StringBuffer();
  
  		for (Entry<Thread, StackTraceElement[]> entry : activeThreadStackTraces
  				.entrySet()) {
  
  			if (entry.getKey().getId() == threadId) { // If thread ID matches
  														// the requestThreadId,
  														// return the stackTrace
  
  				for (StackTraceElement stackTraceElement : entry.getValue()) {
  					requestTheadStackStr.append("\t at " + stackTraceElement
  							+ "\n");
  				}
  				break;
  			}
  
  		}
  		return requestTheadStackStr;
  	}
docs: This method is used to get the stack trace for requested Thread ID. Using
  the Thread class getAllStackTraces() method we get the stack traces for
  all the active threads, then based on the requirement get the Stack
  thread for specific thread ID and return it.
  
  @return