@Test public void backoff() throws IgniteSpiOperationTimeoutException { ExponentialBackoffTimeoutStrategy strategy = new ExponentialBackoffTimeoutStrategy( 25_000L, 1000L, 3_000L ); assertEquals(1000L, strategy.nextTimeout()); assertEquals(1000L, strategy.nextTimeout(1000L)); assertEquals(2000L, strategy.nextTimeout()); assertEquals(1000L, strategy.nextTimeout(1000L)); assertEquals(2000L, strategy.nextTimeout(2000L)); assertEquals(3000L, strategy.nextTimeout()); assertEquals(3000L, strategy.nextTimeout()); assertEquals(100L, strategy.nextTimeout(100L)); }
@Override public long nextTimeout(long timeout) throws IgniteSpiOperationTimeoutException { long remainingTime = remainingTime(System.nanoTime()); if (remainingTime <= 0) throw new IgniteSpiOperationTimeoutException("Operation timed out [timeoutStrategy= " + this + "]"); if (timeout == 0) { long prevTimeout = currTimeout; currTimeout = backoffTimeout(currTimeout, maxTimeout); return Math.min(prevTimeout, remainingTime); } else return Math.min(timeout, remainingTime); }
ExponentialBackoffTimeoutStrategy implements TimeoutStrategy { @Override public long nextTimeout(long timeout) throws IgniteSpiOperationTimeoutException { long remainingTime = remainingTime(System.nanoTime()); if (remainingTime <= 0) throw new IgniteSpiOperationTimeoutException("Operation timed out [timeoutStrategy= " + this + "]"); if (timeout == 0) { long prevTimeout = currTimeout; currTimeout = backoffTimeout(currTimeout, maxTimeout); return Math.min(prevTimeout, remainingTime); } else return Math.min(timeout, remainingTime); } }
ExponentialBackoffTimeoutStrategy implements TimeoutStrategy { @Override public long nextTimeout(long timeout) throws IgniteSpiOperationTimeoutException { long remainingTime = remainingTime(System.nanoTime()); if (remainingTime <= 0) throw new IgniteSpiOperationTimeoutException("Operation timed out [timeoutStrategy= " + this + "]"); if (timeout == 0) { long prevTimeout = currTimeout; currTimeout = backoffTimeout(currTimeout, maxTimeout); return Math.min(prevTimeout, remainingTime); } else return Math.min(timeout, remainingTime); } ExponentialBackoffTimeoutStrategy(
        long totalTimeout,
        long startTimeout,
        long maxTimeout
    ); }
ExponentialBackoffTimeoutStrategy implements TimeoutStrategy { @Override public long nextTimeout(long timeout) throws IgniteSpiOperationTimeoutException { long remainingTime = remainingTime(System.nanoTime()); if (remainingTime <= 0) throw new IgniteSpiOperationTimeoutException("Operation timed out [timeoutStrategy= " + this + "]"); if (timeout == 0) { long prevTimeout = currTimeout; currTimeout = backoffTimeout(currTimeout, maxTimeout); return Math.min(prevTimeout, remainingTime); } else return Math.min(timeout, remainingTime); } ExponentialBackoffTimeoutStrategy(
        long totalTimeout,
        long startTimeout,
        long maxTimeout
    ); static long totalBackoffTimeout(
            long initTimeout,
            long maxTimeout,
            long reconCnt
    ); static long backoffTimeout(long timeout, long maxTimeout); @Override long nextTimeout(long timeout); @Override boolean checkTimeout(long timeInFut); @Override String toString(); }
ExponentialBackoffTimeoutStrategy implements TimeoutStrategy { @Override public long nextTimeout(long timeout) throws IgniteSpiOperationTimeoutException { long remainingTime = remainingTime(System.nanoTime()); if (remainingTime <= 0) throw new IgniteSpiOperationTimeoutException("Operation timed out [timeoutStrategy= " + this + "]"); if (timeout == 0) { long prevTimeout = currTimeout; currTimeout = backoffTimeout(currTimeout, maxTimeout); return Math.min(prevTimeout, remainingTime); } else return Math.min(timeout, remainingTime); } ExponentialBackoffTimeoutStrategy(
        long totalTimeout,
        long startTimeout,
        long maxTimeout
    ); static long totalBackoffTimeout(
            long initTimeout,
            long maxTimeout,
            long reconCnt
    ); static long backoffTimeout(long timeout, long maxTimeout); @Override long nextTimeout(long timeout); @Override boolean checkTimeout(long timeInFut); @Override String toString();  }