public String threadDump(){
  StringBuilder dump=new StringBuilder();
  int retries=0;
  while (retries < CONNECT_RETRIES) {
    try {
      if (canDumpLocks) {
        if (tmbean.isObjectMonitorUsageSupported() && tmbean.isSynchronizerUsageSupported()) {
          dumpThreadInfoWithLocks(dump);
        }
      }
 else {
        dumpThreadInfo(dump);
      }
      retries=CONNECT_RETRIES;
    }
 catch (    NullPointerException npe) {
      if (retries >= CONNECT_RETRIES) {
        JOptionPane.showMessageDialog(null,"Error requesting dump using the JMX Connection. Remote VM returned nothing.\n" + "You can try to reconnect or just simply try to request a dump again.","Error during requesting Dump",JOptionPane.ERROR_MESSAGE);
        return ("");
      }
      try {
        Thread.sleep(1000);
      }
 catch (      InterruptedException ex) {
        ex.printStackTrace();
      }
      retries++;
    }
  }
  dump.append("\n<EndOfDump>\n\n");
  return (dump.toString());
}

public String threadDump ( ) { StringBuilder dump = new StringBuilder ( ) ; int retries = 0 ; while ( retries < CONNECT_RETRIES ) { try { if ( canDumpLocks ) { if ( tmbean . isObjectMonitorUsageSupported ( ) && tmbean . isSynchronizerUsageSupported ( ) ) { dumpThreadInfoWithLocks ( dump ) ; } } else { dumpThreadInfo ( dump ) ; } retries = CONNECT_RETRIES ; } catch ( NullPointerException npe ) { if ( retries >= CONNECT_RETRIES ) { JOptionPane . showMessageDialog ( null , "Error requesting dump using the JMX Connection. Remote VM returned nothing.\n" + "You can try to reconnect or just simply try to request a dump again." , "Error during requesting Dump" , JOptionPane . ERROR_MESSAGE ) ; return ( "" ) ; } try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException ex ) { ex . printStackTrace ( ) ; } retries ++ ; } } dump . append ( "\n<EndOfDump>\n\n" ) ; return ( dump . toString ( ) ) ; }
prints the thread dump information to system . out .
