question: public void run ( ) { while ( m_keyboardStream != null ) { try { if ( m_keyboardReadRequest ) { String s = m_keyboardStream . readLine ( ) ; m_keyboardInput . add ( s ) ; m_keyboardReadRequest = false ; synchronized ( this ) { notifyAll ( ) ; } } else try { Thread . sleep ( 50 ) ; } catch ( InterruptedException ie ) { } } catch ( IOException io ) { } } }
target:  A seperate thread collects our input so that we can block in the doContinue on the main thread and then allow the user to interrupt us via keyboard input on this thread. <p/> We built the stupid thing in this manner, since readLine() will block no matter what and if we 'quit' we can't seem to kill this thread.  .close() doesn't work and Thread.stop(), etc. all fail to do the job. <p/> Thus we needed to take a request response approach so that we only block when requested to do so.