/** * Throws an IOException if {@code throwOnTimeout} is {@code true} and a * timeout occurred. See {@link #newTimeoutException(IOException)} * for the type of exception thrown. */ final void exit(boolean throwOnTimeout) throws IOException { boolean timedOut = exit(); if (timedOut && throwOnTimeout) throw newTimeoutException(null); }
/** * Returns either {@code cause} or an IOException that's caused by * {@code cause} if a timeout occurred. See * {@link #newTimeoutException(IOException)} for the type of * exception returned. */ final IOException exit(IOException cause) throws IOException { if (!exit()) return cause; return newTimeoutException(cause); }