/** * The close operation relays to {@link #finish()}. * Implementing it allows Duration instances to be automatically * finish()'d in Java7 try blocks for when used in measuring durations. */ @Override public final void close() { finish(); }
/** * Start * @return self */ public Duration start() { start = now(); return this; }
public int waitForRoleInstanceLive(String role, long timeout) throws WaitTimeoutException, IOException, YarnException { Duration duration = new Duration(timeout); duration.start(); boolean live = false; int state = StateValues.STATE_CREATED; if (duration.getLimitExceeded()) { throw new WaitTimeoutException( String.format("Timeout after %d millis" + duration.close();
duration.limit, desiredState); duration.start(); try { while (true) { return r; if (duration.getLimitExceeded()) { log.debug( "Wait limit of {} millis to get to state {}, exceeded; app status\n {}", duration.close();
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Duration"); if (finish >= start) { builder.append(" finished at ").append(getInterval()).append(" millis;"); } else { if (start > 0) { builder.append(" started but not yet finished;"); } else { builder.append(" unstarted;"); } } if (limit > 0) { builder.append(" limit: ").append(limit).append(" millis"); if (getLimitExceeded()) { builder.append(" - exceeded"); } } return builder.toString(); }
ApplicationReport applicationReport = application.monitorAppToState(YarnApplicationState.FINISHED, new Duration(waittime * 1000)); if (applicationReport == null) { log.info("application did not shut down in time");
public int waitForRoleInstanceLive(String role, long timeout) throws WaitTimeoutException, IOException, YarnException { Duration duration = new Duration(timeout); duration.start(); boolean live = false; int state = StateValues.STATE_CREATED; if (duration.getLimitExceeded()) { throw new WaitTimeoutException( String.format("Timeout after %d millis" + duration.close();
duration.limit, desiredState); duration.start(); try { while (true) { return r; if (duration.getLimitExceeded()) { log.debug( "Wait limit of {} millis to get to state {}, exceeded; app status\n {}", duration.close();
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Duration"); if (finish >= start) { builder.append(" finished at ").append(getInterval()).append(" millis;"); } else { if (start > 0) { builder.append(" started but not yet finished;"); } else { builder.append(" unstarted;"); } } if (limit > 0) { builder.append(" limit: ").append(limit).append(" millis"); if (getLimitExceeded()) { builder.append(" - exceeded"); } } return builder.toString(); }
ApplicationReport applicationReport = application.monitorAppToState(YarnApplicationState.FINISHED, new Duration(waittime * 1000)); if (applicationReport == null) { log.info("application did not shut down in time");
ApplicationId appId; appId = application.getApplicationId(); Duration timeout = new Duration(connectTimeout); timeout.start(); Exception exception = null; YarnApplicationState state = null; return getProxy(conf, application, rpcTimeout); } catch (IOException e) { if (connectTimeout <= 0 || timeout.getLimitExceeded()) { throw e; if (connectTimeout <= 0 || timeout.getLimitExceeded()) { throw e; ErrorStrings.E_FINISHED_APPLICATION, appId, state ); } finally { timeout.close();
/** * return true if the limit has been exceeded * @return true if a limit was set and the current time * exceeds it. */ public boolean getLimitExceeded() { return limit >= 0 && ((now() - start) > limit); }
/** * The close operation relays to {@link #finish()}. * Implementing it allows Duration instances to be automatically * finish()'d in Java7 try blocks for when used in measuring durations. */ @Override public final void close() { finish(); }
ApplicationId appId; appId = application.getApplicationId(); Duration timeout = new Duration(connectTimeout); timeout.start(); Exception exception = null; YarnApplicationState state = null; return getProxy(conf, application, rpcTimeout); } catch (IOException e) { if (connectTimeout <= 0 || timeout.getLimitExceeded()) { throw e; if (connectTimeout <= 0 || timeout.getLimitExceeded()) { throw e; ErrorStrings.E_FINISHED_APPLICATION, appId, state ); } finally { timeout.close();
/** * Start * @return self */ public Duration start() { start = now(); return this; }
/** * return true if the limit has been exceeded * @return true if a limit was set and the current time * exceeds it. */ public boolean getLimitExceeded() { return limit >= 0 && ((now() - start) > limit); }
public void finish() { finish = now(); }
public void finish() { finish = now(); }