|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread gov.bnl.star.offline.scheduler.util.Task gov.bnl.star.offline.scheduler.util.CommandLineTask
public class CommandLineTask
A command line task. Fork and execute programs in separate time limited thread.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class gov.bnl.star.offline.scheduler.util.Task |
---|
exitStatus |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
CommandLineTask(java.lang.String commandLine)
A new command line task. |
|
CommandLineTask(java.lang.String[] commandLineArray,
boolean bufferCommandOutput)
A new command line task. |
|
CommandLineTask(java.lang.String commandLine,
boolean bufferCommandOutput)
A new command line task. |
|
CommandLineTask(java.lang.String commandLine,
int msTimeout)
A new command line task with a timeout. |
|
CommandLineTask(java.lang.String commandLine,
int msTimeout,
boolean bufferCommandOutput)
|
Method Summary | |
---|---|
void |
destroy()
|
java.lang.String |
getOutput()
Returns all the output of the command. |
java.io.BufferedReader |
getOutputReader()
Returns the output of the command |
static void |
main(java.lang.String[] args)
|
void |
run()
Calls the external command. |
Methods inherited from class gov.bnl.star.offline.scheduler.util.Task |
---|
execute, getExitStatus |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CommandLineTask(java.lang.String commandLine)
WARNING: the parsing of the command line won't be what you would have while executing at a UNIX prompt. The command line won't be passed to the shell, that is why it may have different result. For example, wildcards are usually resolved by the shell, and not by the program themselves.
commandLine
- the command line to be executedpublic CommandLineTask(java.lang.String commandLine, boolean bufferCommandOutput)
getOutput
or
getOutputReader
WARNING: the parsing of the command line won't be what you would have while executing at a UNIX prompt. The command line won't be passed to the shell, that is why it may have different result. For example, wildcards are usually resolved by the shell, and not by the program themselves.
commandLine
- the command line to be executedbufferCommandOutput
- if true, the output will be bufferedpublic CommandLineTask(java.lang.String commandLine, int msTimeout)
WARNING: the parsing of the command line won't be what you would have while executing at a UNIX prompt. The command line won't be passed to the shell, that is why it may have different result. For example, wildcards are usually resolved by the shell, and not by the program themselves.
commandLine
- msTimeout
- public CommandLineTask(java.lang.String commandLine, int msTimeout, boolean bufferCommandOutput)
public CommandLineTask(java.lang.String[] commandLineArray, boolean bufferCommandOutput)
getOutput
or
getOutputReader
By actually specifying he argument as a String array, this constructor gives you better control of what is being executed
commandLineArray
- the command line to be executed already parsed in the different argumentsbufferCommandOutput
- if true, the output will be bufferedMethod Detail |
---|
public void run()
execute
instead.
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void destroy()
destroy
in class java.lang.Thread
public java.lang.String getOutput()
public java.io.BufferedReader getOutputReader()
public static void main(java.lang.String[] args)
args
- the command line arguments
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |