public class TimeoutProcessCloser extends StandardProcessCloser
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.
streams| Constructor and Description |
|---|
TimeoutProcessCloser(ExecuteStreamHandler streams,
long timeout,
TimeUnit unit)
Creates new instance of
TimeoutProcessCloser. |
| Modifier and Type | Method and Description |
|---|---|
void |
close(Process process)
Closes standard streams of a given sub process.
|
protected void |
doClose(Process process) |
public TimeoutProcessCloser(ExecuteStreamHandler streams, long timeout, TimeUnit unit)
TimeoutProcessCloser.streams - helper for pumping the streams.timeout - how long should we wait for the closing.unit - unit of the timeout value.public void close(Process process) throws IOException, InterruptedException
ProcessCloserclose in interface ProcessCloserclose in class StandardProcessCloserprocess - sub process (not null).IOException - if I/O errors occur while closing the underlying streamInterruptedException - if underlying throws a InterruptedExceptionprotected void doClose(Process process) throws IOException, InterruptedException
IOExceptionInterruptedExceptionCopyright © 2020 ZeroTurnaround. All rights reserved.