@Override public void run() { dumpRecorder(); } });
public static void dumpRecorder() { dumpRecorder(null); }
@Override public void run() { try { Thread.sleep(millis); dumpRecorder(filename); } catch (InterruptedException e) { } } }, "DEBUG").start();
private static void dumpRecorder() { if (isDebug()) { final String fileName = getDumpFile(); if (fileName != null && !fileName.trim().equals("")) { if (fileDumped.compareAndSet(false, true)) dumpRecorder(fileName); } else System.err.println("NO ERROR LOG FILE SPECIFIED."); } }
@Override public void failed(Throwable e, Description desc) { System.out.println("FAILED TEST " + desc.getMethodName() + ": " + e.getMessage()); e.printStackTrace(System.err); if (Debug.isDebug() && !(e instanceof OutOfMemoryError)) { Debug.record(0, "EXCEPTION IN THREAD " + Thread.currentThread().getName() + ": " + e + " - " + Arrays.toString(e.getStackTrace())); Debug.dumpRecorder("quasar." + desc.getClassName() + "." + desc.getMethodName() + ".dump"); } }
@SuppressWarnings("CallToThreadDumpStack") public static void exit(int code, Throwable t, String filename) { final Strand currentStrand = Strand.currentStrand(); if (flightRecorder != null) { flightRecorder.record(1, "DEBUG EXIT REQUEST ON STRAND " + currentStrand + ": " + Arrays.toString(currentStrand.getStackTrace())); if (t != null) flightRecorder.record(1, "CAUSED BY " + t + ": " + Arrays.toString(currentStrand.getStackTrace())); flightRecorder.stop(); } if (requestShutdown.compareAndSet(false, true)) { System.err.println("DEBUG EXIT REQUEST ON STRAND " + currentStrand + (currentStrand.isFiber() ? " (THREAD " + Thread.currentThread() + ")" : "") + ": SHUTTING DOWN THE JVM."); Thread.dumpStack(); if (t != null) { System.err.println("CAUSED BY " + t); t.printStackTrace(); } dumpRecorder(filename); if (!isUnitTest()) // Calling System.exit() in gradle unit tests breaks gradle System.exit(code); } }