@Override public boolean cancel( boolean mayInterruptIfRunning ) { try { return realFuture.cancel( mayInterruptIfRunning ); } finally { processOutput.done(); } }
@Override public Integer get() throws InterruptedException, ExecutionException { try { return realFuture.get(); } finally { processOutput.done(); } }
@Override public Integer get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException, TimeoutException { try { return realFuture.get( timeout, unit ); } finally { processOutput.done(); } } };
public int waitForResult() { launch(); try { return process.waitFor(); } catch ( InterruptedException e ) { Thread.interrupted(); return 0; } finally { done(); } } }