src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 351                                               ti.getThreadName(),
 352                                               ti.getThreadState().toString()));
 353                             } else if (ti.getLockOwnerName() == null) {
 354                                 sb.append(Resources.format(Messages.NAME_STATE_LOCK_NAME,
 355                                               ti.getThreadName(),
 356                                               ti.getThreadState().toString(),
 357                                               ti.getLockName()));
 358                             } else {
 359                                 sb.append(Resources.format(Messages.NAME_STATE_LOCK_NAME_LOCK_OWNER,
 360                                               ti.getThreadName(),
 361                                               ti.getThreadState().toString(),
 362                                               ti.getLockName(),
 363                                               ti.getLockOwnerName()));
 364                             }
 365                             sb.append(Resources.format(Messages.BLOCKED_COUNT_WAITED_COUNT,
 366                                               ti.getBlockedCount(),
 367                                               ti.getWaitedCount()));
 368                             sb.append(Messages.STACK_TRACE);
 369                             int index = 0;
 370                             for (StackTraceElement e : ti.getStackTrace()) {
 371                                 sb.append(e.toString()+"\n");
 372                                 if (monitors != null) {
 373                                     for (MonitorInfo mi : monitors) {
 374                                         if (mi.getLockedStackDepth() == index) {
 375                                             sb.append(Resources.format(Messages.MONITOR_LOCKED, mi.toString()));
 376                                         }
 377                                     }
 378                                 }
 379                                 index++;
 380                             }
 381                         }
 382                     } catch (IOException ex) {
 383                         // Ignore
 384                     } catch (UndeclaredThrowableException e) {
 385                         proxyClient.markAsDead();
 386                     }
 387                     final String text = sb.toString();
 388                     SwingUtilities.invokeLater(new Runnable() {
 389                         public void run() {
 390                             textArea.setText(text);
 391                             textArea.setCaretPosition(0);




 351                                               ti.getThreadName(),
 352                                               ti.getThreadState().toString()));
 353                             } else if (ti.getLockOwnerName() == null) {
 354                                 sb.append(Resources.format(Messages.NAME_STATE_LOCK_NAME,
 355                                               ti.getThreadName(),
 356                                               ti.getThreadState().toString(),
 357                                               ti.getLockName()));
 358                             } else {
 359                                 sb.append(Resources.format(Messages.NAME_STATE_LOCK_NAME_LOCK_OWNER,
 360                                               ti.getThreadName(),
 361                                               ti.getThreadState().toString(),
 362                                               ti.getLockName(),
 363                                               ti.getLockOwnerName()));
 364                             }
 365                             sb.append(Resources.format(Messages.BLOCKED_COUNT_WAITED_COUNT,
 366                                               ti.getBlockedCount(),
 367                                               ti.getWaitedCount()));
 368                             sb.append(Messages.STACK_TRACE);
 369                             int index = 0;
 370                             for (StackTraceElement e : ti.getStackTrace()) {
 371                                 sb.append(e).append('\n');
 372                                 if (monitors != null) {
 373                                     for (MonitorInfo mi : monitors) {
 374                                         if (mi.getLockedStackDepth() == index) {
 375                                             sb.append(Resources.format(Messages.MONITOR_LOCKED, mi.toString()));
 376                                         }
 377                                     }
 378                                 }
 379                                 index++;
 380                             }
 381                         }
 382                     } catch (IOException ex) {
 383                         // Ignore
 384                     } catch (UndeclaredThrowableException e) {
 385                         proxyClient.markAsDead();
 386                     }
 387                     final String text = sb.toString();
 388                     SwingUtilities.invokeLater(new Runnable() {
 389                         public void run() {
 390                             textArea.setText(text);
 391                             textArea.setCaretPosition(0);