/** Second part of debugger start procedure. */ private void startDebugger() { threadManager = new ThreadManager(this); setBreakpoints(); updateWatches(); println(bundle.getString("CTL_Debugger_running"), STL_OUT); setDebuggerState(DEBUGGER_RUNNING); virtualMachine.resume(); // start refresh thread ................................................. if (debuggerThread != null) debuggerThread.stop(); debuggerThread = new Thread( new Runnable() { public void run() { for (; ; ) { try { Thread.sleep(5000); } catch (InterruptedException ex) { } if (getState() == DEBUGGER_RUNNING) threadGroup.refresh(); } } }, "Debugger refresh thread"); // NOI18N debuggerThread.setPriority(Thread.MIN_PRIORITY); debuggerThread.start(); }
/** * Create a Thread that will retrieve and display any output. Needs to be high priority, else * debugger may exit before it can be displayed. */ private void displayRemoteOutput(final InputStream stream) { Thread thr = new Thread("output reader") { @Override public void run() { try { dumpStream(stream); } catch (IOException ex) { MessageOutput.fatalError("Failed reading output"); } finally { notifyOutputComplete(); } } }; thr.setPriority(Thread.MAX_PRIORITY - 1); thr.start(); }