org.zeroturnaround.exec.close
Class TimeoutProcessCloser
java.lang.Object
org.zeroturnaround.exec.close.StandardProcessCloser
org.zeroturnaround.exec.close.TimeoutProcessCloser
- All Implemented Interfaces:
- ProcessCloser
public class TimeoutProcessCloser
- extends StandardProcessCloser
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.
Method Summary |
void |
close(Process process)
Closes standard streams of a given sub process. |
protected void |
doClose(Process process)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimeoutProcessCloser
public TimeoutProcessCloser(ExecuteStreamHandler streams,
long timeout,
TimeUnit unit)
- Creates new instance of
TimeoutProcessCloser
.
- Parameters:
streams
- helper for pumping the streams.timeout
- how long should we wait for the closing.unit
- unit of the timeout value.
close
public void close(Process process)
throws IOException,
InterruptedException
- Description copied from interface:
ProcessCloser
- Closes standard streams of a given sub process.
- Specified by:
close
in interface ProcessCloser
- Overrides:
close
in class StandardProcessCloser
- Parameters:
process
- sub process (not null
).
- Throws:
IOException
InterruptedException
doClose
protected void doClose(Process process)
throws IOException,
InterruptedException
- Throws:
IOException
InterruptedException
Copyright © 2015 ZeroTurnaround. All rights reserved.