/** * A total hack to see if there are any active Java3D threads running * * @return any java3d threads running */ private static boolean anyJava3dThreadsActive() { ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); long[] ids = threadBean.getAllThreadIds(); for (int i = 0; i < ids.length; i++) { ThreadInfo info = threadBean.getThreadInfo(ids[i], Integer.MAX_VALUE); if (info == null) { continue; } if (info.getThreadState() != Thread.State.RUNNABLE) { continue; } if (info.getThreadName().indexOf("J3D") >= 0) { return true; } } return false; }
@Override public int getSize() { try { return tinfo == null ? 1 : tinfo.getFrameCount(); } catch (VMNotInterruptedException e) { // ### Is this the right way to handle this? return 0; } }
@Override public Object getElementAt(int index) { try { return tinfo == null ? null : tinfo.getFrame(index); } catch (VMNotInterruptedException e) { // ### Is this the right way to handle this? // ### Would happen if user scrolled stack trace // ### while not interrupted -- should probably // ### block user interaction in this case. return null; } }