Package com.cloudera.util

Examples of com.cloudera.util.CappedExponentialBackoff


              new CumulativeCappedExponentialBackoff(initMs, maxMs,
                  cumulativeMaxMs));
        }

        return new InsistentOpenDecorator<EventSink>(null,
            new CappedExponentialBackoff(initMs, maxMs));
      }

    };
  }
View Full Code Here


        FlumeConfiguration.get().getFailoverMaxSingleBackoff());
  }

  public BackOffFailOverSink(EventSink primary, EventSink backup,
      long initialBackoff, long maxBackoff) {
    this(primary, backup, new CappedExponentialBackoff(initialBackoff,
        maxBackoff));
  }
View Full Code Here

   * 'initial' ms, exponentially backs off an individual sleep upto 'sleepCap'
   * ms. This has no cumulative cap and will never give up.
   */
  public InsistentAppendDecorator(S s, long initial, long sleepCap) {
    super(s);
    this.backoff = new CappedExponentialBackoff(initial, sleepCap);
  }
View Full Code Here

   * 'initial' ms, exponentially backs off an individual sleep upto 'sleepCap'
   * ms. This has no cumulative cap and will never give up.
   */
  public InsistentOpenDecorator(S s, long sleepCap, long initial) {
    super(s);
    this.backoff = new CappedExponentialBackoff(initial, sleepCap);
    this.openSuccesses = 0;
    this.openRetries = 0;
  }
View Full Code Here

              new CumulativeCappedExponentialBackoff(initMs, maxMs,
                  cumulativeMaxMs));
        }

        return new InsistentOpenDecorator<EventSink>(null,
            new CappedExponentialBackoff(initMs, maxMs));
      }

    };
  }
View Full Code Here

    // WARNING! This test relies on being able to sleep for ~10ms and be woken
    // up three times in a 5s period. Seems plausible! But if you are looking at
    // this comment, it's probably because the test is failing on a loaded
    // machine...
    BackoffPolicy bop = new CappedExponentialBackoff(10, 5000);
    InsistentOpenDecorator<EventSink> sink = new InsistentOpenDecorator<EventSink>(
        fail2x, bop);
    sink.open();
    sink.append(new EventImpl("test".getBytes()));
    sink.close();
View Full Code Here

    doReturn(new ReportEvent("stub")).when(fail4eva).getMetrics();

    final CountDownLatch done = new CountDownLatch(1);

    // max 5s, backoff initially at 10ms
    BackoffPolicy bop = new CappedExponentialBackoff(10, 5000);
    final InsistentOpenDecorator<EventSink> sink = new InsistentOpenDecorator<EventSink>(
        fail4eva, bop);

    Thread t = new Thread() {
      @Override
View Full Code Here

   * @throws IOException
   * @throws InterruptedException
   */
  @Test
  public void testOpenInterruption() throws IOException, InterruptedException {
    BackoffPolicy bop = new CappedExponentialBackoff(10, 5000);
    EventSink snk = new InsistentOpenDecorator<EventSink>(
        InterruptSinks.openSink(), bop);
    try {
      snk.open();
    } catch (InterruptedException ie) {
View Full Code Here

    EventSink fail4eva = mock(EventSink.Base.class);
    doThrow(new IOException("mock exception")).when(fail4eva).open();
    doReturn(new ReportEvent("stub")).when(fail4eva).getMetrics();

    // max 5s, backoff initially at 10ms
    BackoffPolicy bop = new CappedExponentialBackoff(10, 5000);
    final InsistentOpenDecorator<EventSink> insistent = new InsistentOpenDecorator<EventSink>(
        fail4eva, bop);
    final EventSink sink = new LazyOpenDecorator<EventSink>(insistent);

    // create an endless stream of data
View Full Code Here

    doThrow(new IOException("mock exception")).when(fail4eva).append(e);
    doReturn(new ReportEvent("mock report")).when(fail4eva).getMetrics();
    doReturn("mock name").when(fail4eva).getName();

    // max 5s, backoff initially at 10ms
    BackoffPolicy bop = new CappedExponentialBackoff(10, 5000);
    final EventSink insistent = new InsistentAppendDecorator<EventSink>(
        fail4eva, bop);
    final EventSink sink = new LazyOpenDecorator<EventSink>(insistent);

    // create an endless stream of data
View Full Code Here

TOP

Related Classes of com.cloudera.util.CappedExponentialBackoff

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.