@edu.umd.cs.findbugs.annotations.SuppressWarnings( value = "IL_INFINITE_LOOP", justification = "Endless loop is for debugging purposes.") public static void waitForJavaDebugger(LogWriterI18n logger, String extraLogMsg) { boolean cont = false; String msg = ":"; if (extraLogMsg != null) msg += extraLogMsg; logger.severe(LocalizedStrings.DebuggerSupport_WAITING_FOR_DEBUGGER_TO_ATTACH_0, msg); boolean interrupted = false; while (!cont) { // set cont to true in debugger when ready to continue try { // SET BREAKPOINT HERE Thread.sleep(1000); } catch (InterruptedException e) { interrupted = true; // ...but keep going, waiting for debugger } } // while if (interrupted) { Thread.currentThread().interrupt(); } logger.info(LocalizedStrings.DebuggerSupport_DEBUGGER_CONTINUING); }
/** Notes that an error has occurred in the agent and that it has shut down because of it. */ private void setServerError(final String message, final Throwable cause) { try { writeStatus( createStatus( this.basename, SHUTDOWN_PENDING_AFTER_FAILED_STARTUP, OSProcess.getId(), message, cause)); } catch (Exception e) { if (logger != null) { logger.severe(e); } else { e.printStackTrace(); } System.exit(1); } }