1 16 17 package org.apache.log4j.or; 18 19 import org.apache.log4j.Layout; 20 21 22 27 public class ThreadGroupRenderer implements ObjectRenderer { 28 29 public 30 ThreadGroupRenderer() { 31 } 32 33 48 public 49 String doRender(Object o) { 50 if(o instanceof ThreadGroup ) { 51 StringBuffer sbuf = new StringBuffer (); 52 ThreadGroup tg = (ThreadGroup ) o; 53 sbuf.append("java.lang.ThreadGroup[name="); 54 sbuf.append(tg.getName()); 55 sbuf.append(", maxpri="); 56 sbuf.append(tg.getMaxPriority()); 57 sbuf.append("]"); 58 Thread [] t = new Thread [tg.activeCount()]; 59 tg.enumerate(t); 60 for(int i = 0; i < t.length; i++) { 61 sbuf.append(Layout.LINE_SEP); 62 sbuf.append(" Thread=["); 63 sbuf.append(t[i].getName()); 64 sbuf.append(","); 65 sbuf.append(t[i].getPriority()); 66 sbuf.append(","); 67 sbuf.append(t[i].isDaemon()); 68 sbuf.append("]"); 69 } 70 return sbuf.toString(); 71 } else { 72 return o.toString(); 74 } 75 } 76 } 77 | Popular Tags |