|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.luniks.process.ProcessHandler
Class to handle native processes
| Nested Class Summary | |
(package private) class |
ProcessHandler.InputStreamReaderThread
Thread to read from stdout/stderr of the process |
| Field Summary | |
protected ExitListener |
exitListener
|
protected LineListener |
lineListener
|
protected java.lang.String |
name
|
protected java.lang.Process |
process
|
protected boolean |
running
|
protected ProcessHandler.InputStreamReaderThread |
stderrReaderThread
|
protected ProcessHandler.InputStreamReaderThread |
stdoutReaderThread
|
static int |
TERM_EXIT_CODE
The exit code will be forced to this value when the process has been terminated using the method destroy(). |
protected boolean |
terminated
|
protected boolean |
threaded
|
| Constructor Summary | |
ProcessHandler()
Constructs a ProcessHandler with name "Noname" and no listeners. |
|
ProcessHandler(java.lang.String name,
ExitListener exitListener)
Constructs a ProcessHandler with a name and an exit listener. |
|
ProcessHandler(java.lang.String name,
LineListener lineListener)
Constructs a ProcessHandler with a name and a line listener. |
|
ProcessHandler(java.lang.String name,
LineListener lineListener,
ExitListener exitListener)
Constructs a ProcessHandler with a name, a line listener and an exit listener. |
|
| Method Summary | |
void |
destroy()
Method to terminate the process. |
void |
exec(java.lang.String[] cmdarray)
Run the process with its arguments given as argument. |
java.lang.String |
getName()
Returns the name of this process handler. |
boolean |
hasName(java.lang.String name)
Returns true if the name of this process handler equals the String given as argument, case sensitive. |
boolean |
isRunning()
Returns true if the process is currently running, false if it has not been started yet or has exited. |
void |
kill(int signal)
Calls destroy(), the signal given as argument is ignored |
private void |
lineAction(java.lang.String line)
Method to synchronize the call to LineListener.lineAction |
void |
setThreaded(boolean threaded)
Method to set if the process should be run in a separate thread or not. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int TERM_EXIT_CODE
protected java.lang.Process process
protected java.lang.String name
protected boolean running
protected boolean terminated
protected boolean threaded
protected ProcessHandler.InputStreamReaderThread stdoutReaderThread
protected ProcessHandler.InputStreamReaderThread stderrReaderThread
protected LineListener lineListener
protected ExitListener exitListener
| Constructor Detail |
public ProcessHandler()
public ProcessHandler(java.lang.String name,
LineListener lineListener)
name - the name of the process handlerlineListener - the line listener
public ProcessHandler(java.lang.String name,
ExitListener exitListener)
name - the name of the process handlerexitListener - the exit listener
public ProcessHandler(java.lang.String name,
LineListener lineListener,
ExitListener exitListener)
name - the name of the process handlerlineListener - the line listenerexitListener - the exit listener| Method Detail |
public void setThreaded(boolean threaded)
threaded - true if the process should be run in a separate
process, false otherwisepublic boolean isRunning()
public java.lang.String getName()
public boolean hasName(java.lang.String name)
public void exec(java.lang.String[] cmdarray)
cmdarray - the process to run and its argumentspublic void kill(int signal)
signal - is ignoredpublic void destroy()
private void lineAction(java.lang.String line)
line - the line that has just been read from either
stdin or stdout of the process
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||