/** dumps this vm's stacks and returns gzipped result */ public static byte[] zipStacks() throws IOException { ThreadMXBean bean = ManagementFactory.getThreadMXBean(); long[] threadIds = bean.getAllThreadIds(); ThreadInfo[] infos = bean.getThreadInfo(threadIds, true, true); long thisThread = Thread.currentThread().getId(); ByteArrayOutputStream baos = new ByteArrayOutputStream(10000); GZIPOutputStream zipOut = new GZIPOutputStream(baos, 10000); PrintWriter pw = new PrintWriter(zipOut, true); for (int i=0; i<infos.length; i++) { if (i != thisThread && infos[i] != null) { formatThreadInfo(infos[i], pw); } } pw.flush(); zipOut.close(); byte[] result = baos.toByteArray(); return result; }
/** dumps this vm's stacks and returns gzipped result */ public static byte[] zipStacks() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(10000); GZIPOutputStream zipOut = new GZIPOutputStream(baos, 10000); PrintWriter pw = new PrintWriter(zipOut, true); final GemFireCacheImpl.StaticSystemCallbacks sysCb = GemFireCacheImpl .getInternalProductCallbacks(); if (sysCb == null) { ThreadMXBean bean = ManagementFactory.getThreadMXBean(); long[] threadIds = bean.getAllThreadIds(); ThreadInfo[] infos = bean.getThreadInfo(threadIds, true, true); long thisThread = Thread.currentThread().getId(); for (int i = 0; i < infos.length; i++) { if (i != thisThread && infos[i] != null) { formatThreadInfo(infos[i], pw); } } } else { sysCb.printStacks(pw); } pw.flush(); zipOut.close(); byte[] result = baos.toByteArray(); return result; }
for (int i=0; i<infos.length; i++) { if (i != thisThread && infos[i] != null) { formatThreadInfo(infos[i], sb);
for (int i=0; i<infos.length; i++) { if (i != thisThread && infos[i] != null) { formatThreadInfo(infos[i], sb);