java.lang.Object
java.lang.Thread
net.i2p.util.I2PThread
net.i2p.util.I2PAppThread
net.i2p.util.ShellCommand.CommandThread
- All Implemented Interfaces:
Runnable
- Enclosing class:
ShellCommand
Executes a shell command in its own thread.
Nested Class Summary
Nested classes/interfaces inherited from class I2PThread
I2PThread.OOMEventListenerModifier and TypeClassDescriptionstatic interfaceListener for out-of-memory events.Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandlerField Summary
FieldsModifier and TypeFieldDescriptionprivate final String[]Environment for the command, null to inherit.private final ShellCommand.ResultCollects the command's exit code and output.private final ObjectThe command to run, a String or a String array.Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITYConstructor Summary
ConstructorsConstructorDescriptionCommandThread(Object shellCommand, String[] envp, ShellCommand.Result res) Runs the shell command in a thread with an explicit environment.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidrun()Run the thread, catching and reporting OOM and other failures.Methods inherited from class I2PAppThread
addOOMEventThreadListener, fireOOM, removeOOMEventThreadListenerModifier and TypeMethodDescriptionvoidRegister a new component that wants notification of OOM events.protected voidfireOOM(OutOfMemoryError oom) Notify listeners that an OutOfMemoryError occurred.voidUnregister a component that wants notification of OOM events.Methods inherited from class I2PThread
addOOMEventListener, removeOOMEventListener, startModifier and TypeMethodDescriptionstatic voidRegister a new component that wants notification of OOM events.static voidUnregister a component that wants notification of OOM events.voidstart()Overridden to provide useful info to users on OOM, and to prevent shutting down the whole JVM for what is most likely not a heap issue.Methods inherited from class Thread
activeCount, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, startVirtualThread, threadId, toString, yield
Field Details
shellCommand
The command to run, a String or a String array.envp
Environment for the command, null to inherit.result
Collects the command's exit code and output.
Constructor Details
CommandThread
CommandThread(Object shellCommand, String[] envp, ShellCommand.Result res) Runs the shell command in a thread with an explicit environment.- Parameters:
shellCommand- either a String or a String[] (since 0.8.3)envp- environment entries as NAME=value strings, or null to inheritres- holder for the exit status, written when the thread runs
Method Details
run