org.erights.e.extern.file
Class ConsoleThread
java.lang.Object
|
+--org.erights.e.extern.file.ConsoleThread
- All Implemented Interfaces:
- Runnable
- public class ConsoleThread
- extends Object
- implements Runnable
Untamed: Implements a seperate thread to manage the user console (i.e., the keyboard
and tty). This needs to be in its own thread so that the user pondering
what to type next doesn't block the entire E runQ!
The console is given an input handler when it is created, which is an object
that implements the ConsoleInputHandler interface. Each line of input typed
on the console is sent as a String in an E-message to the input handler. End
of file is signalled to the input handler by sending it a null. If a
problem is thrown while reading, the handler is asked to handle it as well.
Method Summary |
void |
run()
Enabled: This is the actual thread code for the ConsoleThread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
myLock
private final Object myLock
myHandler
private final ConsoleInputHandler myHandler
myIn
private BufferedReader myIn
myOptOut
private PrintWriter myOptOut
nowait
private boolean nowait
ConsoleThread
ConsoleThread(ConsoleInputHandler handler,
BufferedReader in,
PrintWriter optOut)
- Constructs a new console object given a handler and the console input
and output, then starts the thread.
- Parameters:
handler
- The E object that is to receive input lines.in
- The console input source.
run
public void run()
- Enabled: This is the actual thread code for the ConsoleThread.
- Specified by:
run
in interface Runnable
- See Also:
java.lang.Thread#run()
comments?