Package com.cloudera.util

Examples of com.cloudera.util.CappedExponentialBackoff


    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);
    final EventSink roll = new RollSink(new ReportTestingContext(), "mock",
        10000, 100) {
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 StubbornAppendSink<EventSink> stubborn = new StubbornAppendSink<EventSink>(
        insistent);
    final InsistentAppendDecorator<EventSink> append = new InsistentAppendDecorator<EventSink>(
        stubborn, new CappedExponentialBackoff(100, 100000));
    final EventSink sink = new LazyOpenDecorator<EventSink>(append);

    // create an endless stream of data
    final EventSource source = new LazyOpenSource<EventSource>(
        new NoNlASCIISynthSource(0, 100));
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).getReport();

    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

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

    // 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);
    sink.open();
View Full Code Here

    doThrow(new IOException("mock exception")).when(fail4eva).append(e);
    doReturn(new ReportEvent("mock report")).when(fail4eva).getReport();
    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);
    sink.open();
View Full Code Here

    doThrow(new IOException("mock exception")).when(fail4eva).append(e);
    doReturn(new ReportEvent("mock report")).when(fail4eva).getReport();
    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);
    final EventSink roll = new RollSink(new ReportTestingContext(), "mock",
        10000, 100) {
View Full Code Here

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

    // max 5s, backoff initially at 10ms
    BackoffPolicy bop = new CappedExponentialBackoff(10, 5000);

    final InsistentOpenDecorator<EventSink> insistent = new InsistentOpenDecorator<EventSink>(
        fail4eva, bop);
    final StubbornAppendSink<EventSink> stubborn = new StubbornAppendSink<EventSink>(
        insistent);
    final InsistentAppendDecorator<EventSink> append = new InsistentAppendDecorator<EventSink>(
        stubborn, new CappedExponentialBackoff(100, 100000));
    final EventSink sink = new LazyOpenDecorator<EventSink>(append);
    sink.open();

    // create an endless stream of data
    final EventSource source = new LazyOpenSource<EventSource>(
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

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.