public abstract class BaseProcessHandler<T extends java.lang.Process> extends ProcessHandler implements TaskExecutor
Modifier and Type | Field and Description |
---|---|
protected java.nio.charset.Charset |
myCharset |
protected java.lang.String |
myCommandLine |
protected java.lang.String |
myPresentableName |
protected T |
myProcess |
protected ProcessWaitFor |
myWaitFor |
SILENTLY_DESTROY_ON_CLOSE, TERMINATION_REQUESTED
Constructor and Description |
---|
BaseProcessHandler(T process,
java.lang.String commandLine,
java.nio.charset.Charset charset)
commandLine must not be empty (for correct thread attribution in the stacktrace) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeStreams() |
protected void |
destroyProcessImpl()
Performs process destruction.
|
boolean |
detachIsDefault() |
protected void |
detachProcessImpl()
Performs detaching process.
|
protected void |
doDestroyProcess() |
java.nio.charset.Charset |
getCharset() |
java.lang.String |
getCommandLine() |
T |
getProcess() |
java.io.OutputStream |
getProcessInput() |
protected void |
onOSProcessTerminated(int exitCode) |
addProcessListener, addProcessListener, destroyProcess, detachProcess, getExitCode, isProcessTerminated, isProcessTerminating, isSilentlyDestroyOnClose, isStartNotified, notifyProcessDetached, notifyProcessTerminated, notifyTextAvailable, removeProcessListener, startNotify, waitFor, waitFor
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
executeTask
protected final T extends java.lang.Process myProcess
protected final java.lang.String myCommandLine
protected final java.nio.charset.Charset myCharset
protected final java.lang.String myPresentableName
protected final ProcessWaitFor myWaitFor
public BaseProcessHandler(T process, java.lang.String commandLine, java.nio.charset.Charset charset)
commandLine
must not be empty (for correct thread attribution in the stacktrace)public final T getProcess()
public java.lang.String getCommandLine()
public java.nio.charset.Charset getCharset()
public java.io.OutputStream getProcessInput()
getProcessInput
in class ProcessHandler
protected void onOSProcessTerminated(int exitCode)
protected void doDestroyProcess()
protected void destroyProcessImpl()
ProcessHandler
This is an internal implementation of ProcessHandler.destroyProcess()
. All sub-classes must implement this method and perform the
destruction in this method. This method is called from ProcessHandler.destroyProcess()
and it can be in any thread including the
event dispatcher thread. You should avoid doing any expensive operation directly in this method. Instead, you may post the work to
background thread and return without waiting for it. If the performed destruction led to process termination,
ProcessHandler.notifyProcessTerminated(int)
must be called in any thread (not necessary from this method).
destroyProcessImpl
in class ProcessHandler
protected void detachProcessImpl()
ProcessHandler
This is an internal implementation of ProcessHandler.detachProcess()
. All sub-classes must implement this method and perform the
detaching in this method. This method is called from ProcessHandler.detachProcess()
and it can be in any thread including the
event dispatcher thread. You should avoid doing any expensive operation directly in this method. Instead, you may post the work to
background thread and return without waiting for it. If the performed detaching is completed,
ProcessHandler.notifyProcessTerminated(int)
must be called in any thread (not necessary from this method).
detachProcessImpl
in class ProcessHandler
public boolean detachIsDefault()
detachIsDefault
in class ProcessHandler
protected void closeStreams()