/** Track a success - reset back off interval to the initial value */ public final void trackSuccess() { backoff = params.initial; retryTime = Utils.currentTimeMillis(); }
/** Track a success - reset back off interval to the initial value */ public final void trackSuccess() { backoff = params.initial; retryTime = Utils.currentTimeMillis(); }
/** Track a success - reset back off interval to the initial value */ public final void trackSuccess() { backoff = params.initial; retryTime = Utils.currentTimeMillis(); }
/** Track a success - reset back off interval to the initial value */ public final void trackSuccess() { backoff = params.initial; retryTime = Utils.currentTimeMillis(); }
public PendingPing(long nonce) { future = SettableFuture.create(); this.nonce = nonce; startTimeMsec = Utils.currentTimeMillis(); }
/** Track a failure - multiply the back off interval by the multiplier */ public void trackFailure() { retryTime = Utils.currentTimeMillis() + (long)backoff; backoff = Math.min(backoff * params.multiplier, params.maximum); }
public PendingPing(long nonce) { future = SettableFuture.create(); this.nonce = nonce; startTimeMsec = Utils.currentTimeMillis(); }
/** Track a failure - multiply the back off interval by the multiplier */ public void trackFailure() { retryTime = Utils.currentTimeMillis() + (long)backoff; backoff = Math.min(backoff * params.multiplier, params.maximum); }
/** Track a failure - multiply the back off interval by the multiplier */ public void trackFailure() { retryTime = Utils.currentTimeMillis() + (long)backoff; backoff = Math.min(backoff * params.multiplier, params.maximum); }
/** Track a failure - multiply the back off interval by the multiplier */ public void trackFailure() { retryTime = Utils.currentTimeMillis() + (long)backoff; backoff = Math.min(backoff * params.multiplier, params.maximum); }
/** * Same as {@link #addWatchedAddress(Address, long)} with the current time as the creation time. */ public boolean addWatchedAddress(final Address address) { long now = Utils.currentTimeMillis() / 1000; return addWatchedAddresses(Lists.newArrayList(address), now) == 1; }
/** * Same as {@link #addWatchedAddress(Address, long)} with the current time as the creation time. */ public boolean addWatchedAddress(final Address address) { long now = Utils.currentTimeMillis() / 1000; return addWatchedAddresses(Lists.newArrayList(address), now) == 1; }
/** * Same as {@link #addWatchedAddress(Address, long)} with the current time as the creation time. */ public boolean addWatchedAddress(final Address address) { long now = Utils.currentTimeMillis() / 1000; return addWatchedAddresses(Lists.newArrayList(address), now) == 1; }
/** * Same as {@link #addWatchedAddress(Address, long)} with the current time as the creation time. */ public boolean addWatchedAddress(final Address address) { long now = Utils.currentTimeMillis() / 1000; return addWatchedAddresses(Lists.newArrayList(address), now) == 1; }
public void complete() { if (!future.isDone()) { Long elapsed = Utils.currentTimeMillis() - startTimeMsec; Peer.this.addPingTimeData(elapsed); log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed); future.set(elapsed); } } }
public void complete() { if (!future.isDone()) { Long elapsed = Utils.currentTimeMillis() - startTimeMsec; Peer.this.addPingTimeData(elapsed); log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed); future.set(elapsed); } } }
public void complete() { if (!future.isDone()) { Long elapsed = Utils.currentTimeMillis() - startTimeMsec; Peer.this.addPingTimeData(elapsed); log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed); future.set(elapsed); } } }
public void complete() { if (!future.isDone()) { Long elapsed = Utils.currentTimeMillis() - startTimeMsec; Peer.this.addPingTimeData(elapsed); log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed); future.set(elapsed); } } }
@Test public void testSuccess() { assertEquals(Utils.currentTimeMillis(), backoff.getRetryTime()); backoff.trackFailure(); backoff.trackFailure(); backoff.trackSuccess(); assertEquals(Utils.currentTimeMillis(), backoff.getRetryTime()); }
@Test public void testFailure() { assertEquals(Utils.currentTimeMillis(), backoff.getRetryTime()); backoff.trackFailure(); backoff.trackFailure(); backoff.trackFailure(); assertEquals(Utils.currentTimeMillis() + 121, backoff.getRetryTime()); }