Class TimeoutProcessCloser
java.lang.Object
org.zeroturnaround.exec.close.StandardProcessCloser
org.zeroturnaround.exec.close.TimeoutProcessCloser
- All Implemented Interfaces:
ProcessCloser
Same as
StandardProcessCloser but only waits fixed period for the closing.
On timeout a warning is logged but no error is thrown.
This is used on Windows where sometimes sub process' streams do not close properly.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final longprivate final TimeUnitFields inherited from class StandardProcessCloser
streams -
Constructor Summary
ConstructorsConstructorDescriptionTimeoutProcessCloser(ExecuteStreamHandler streams, long timeout, TimeUnit unit) Creates new instance ofTimeoutProcessCloser. -
Method Summary
-
Field Details
-
log
private static final org.slf4j.Logger log -
timeout
private final long timeout -
unit
-
-
Constructor Details
-
TimeoutProcessCloser
Creates new instance ofTimeoutProcessCloser.- Parameters:
streams- helper for pumping the streams.timeout- how long should we wait for the closing.unit- unit of the timeout value.
-
-
Method Details
-
close
Description copied from interface:ProcessCloserCloses standard streams of a given sub process.- Specified by:
closein interfaceProcessCloser- Overrides:
closein classStandardProcessCloser- Parameters:
process- sub process (notnull).- Throws:
IOException- if I/O errors occur while closing the underlying streamInterruptedException- if underlying throws a InterruptedException
-
doClose
- Throws:
IOExceptionInterruptedException
-
getUnitsAsString
-