public String toStringRounded() { return Time.makeTimeStringRounded(this); }
String duration = Time.makeTimeStringRounded(elapsed); rv = "Ended "; if (isCancelled()) {
/** @deprecated since 0.6.0 use {@link #makeTimeStringRounded(long, unit)} */ @Deprecated public static String makeTimeString(long t, TimeUnit unit) { return makeTimeStringRounded(t, unit); } /** @see #makeTimeString(long, boolean) */
/** @deprecated use {@link Time#makeTimeStringRounded(long)} */ @Deprecated public static String makeTimeString(long utcMillis) { return Time.makeTimeStringRounded(utcMillis); }
public static String makeTimeStringRounded(Stopwatch timer) { return makeTimeStringRounded(timer.elapsed(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS); } /** @deprecated since 0.6.0 use {@link #makeTimeStringRounded(long)} */
/** @deprecated since 0.6.0 use {@link #makeTimeStringRounded(long)} */ @Deprecated public static String makeTimeString(long t) { return makeTimeStringRounded(t); } /** @see #makeTimeString(long, boolean) */
/** * Reconnects. If it already is connected, it disconnects first. * * @throws IOException */ public synchronized void reconnectWithRetryDampened() throws IOException { // If we've already tried reconnecting very recently, don't try again immediately if (failedReconnecting) { long timeSince = (System.currentTimeMillis() - failedReconnectingTime); if (timeSince < minTimeBetweenReconnectAttempts) { String msg = "Not reconnecting to JMX at "+url+" because attempt failed "+Time.makeTimeStringRounded(timeSince)+" ago"; throw new IllegalStateException(msg); } } reconnect(); }
errorMessage, (i+1), sshTries, Time.makeTimeStringRounded(stopwatch.elapsed(TimeUnit.MILLISECONDS)), (sshTriesTimeout > 0 ? Time.makeTimeStringRounded(sshTriesTimeout) : "unlimited")); try { disconnect();
if (healthy) { LOG.info("{} health-check for {}, component recovered (from failure at {}): {}", new Object[] {this, entity, Time.makeTimeStringRounded(System.currentTimeMillis() - currentFailureStartTime.get()), description}); if (weSetItOnFire) { if (status == Lifecycle.ON_FIRE)
protected synchronized void onDetectedFailure(SensorEvent<Object> event) { if (isSuspended()) { LOG.warn("ServiceRestarter suspended, so not acting on failure detected at "+entity+" ("+event.getValue()+")"); return; } LOG.warn("ServiceRestarter acting on failure detected at "+entity+" ("+event.getValue()+")"); long current = System.currentTimeMillis(); Long last = lastFailureTime.getAndSet(current); long elapsed = last==null ? -1 : current-last; if (elapsed>=0 && elapsed <= getConfig(FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION)) { onRestartFailed("Restart failure (failed again after "+Time.makeTimeStringRounded(elapsed)+") at "+entity+": "+event.getValue()); return; } try { entity.setAttribute(Attributes.SERVICE_STATE, Lifecycle.STARTING); Entities.invokeEffector(entity, entity, Startable.RESTART).get(); } catch (Exception e) { onRestartFailed("Restart failure (error "+e+") at "+entity+": "+event.getValue()); } }
setup.getDescription(), Time.makeTimeStringRounded(delayMs), user, vmIp, Objects.equal(user, getUser(setup)) ? "" : " (setup user is different: "+getUser(setup)+")"}); Stopwatch stopwatch = new Stopwatch().start(); throw new IllegalStateException("SSH failed for "+ user+"@"+vmIp+" ("+setup.getDescription()+") after waiting "+ Time.makeTimeStringRounded(delayMs)); setup.getDescription(), Time.makeTimeStringRounded(stopwatch), user, vmIp});
count+" item"+Strings.s(count)+" ("+countApps+" app"+Strings.s(countApps)+") in "+Time.makeTimeStringRounded(timer));
Stopwatch stopwatch = new Stopwatch().start(); machineCreationSemaphore.acquire(); LOG.info("Acquired in {} machine-creation permit, after waiting {}", this, Time.makeTimeStringRounded(stopwatch)); } else { LOG.info("Acquired in {} machine-creation permit immediately", this);