Examples of LazyOpenDecorator


Examples of com.cloudera.flume.handlers.debug.LazyOpenDecorator

   * close always happens after open started retrying.
   */
  @Test
  public void testHdfsDownInterruptAfterOpeningRetry()
      throws FlumeSpecException, IOException, InterruptedException {
    final EventSink snk = new LazyOpenDecorator(FlumeBuilder.buildSink(
        new Context(),
        "collectorSink(\"hdfs://nonexistant/user/foo\", \"foo\")"));

    final CountDownLatch started = new CountDownLatch(1);
    final CountDownLatch done = new CountDownLatch(1);

    Thread t = new Thread("append thread") {
      public void run() {
        Event e = new EventImpl("foo".getBytes());
        try {
          snk.open();
          started.countDown();
          snk.append(e);
        } catch (IOException e1) {
          // could throw exception but we don't care
          LOG.info("don't care about this exception: ", e1);
        } catch (InterruptedException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
        done.countDown();
      }
    };
    t.start();
    boolean begun = started.await(60, TimeUnit.SECONDS);
    Clock.sleep(10);
    assertTrue("took too long to start", begun);
    snk.close();
    LOG.info("Interrupting appending thread");
    t.interrupt();
    boolean completed = done.await(60, TimeUnit.SECONDS);
    assertTrue("Timed out when attempting to shutdown", completed);
  }
View Full Code Here

Examples of com.cloudera.flume.handlers.debug.LazyOpenDecorator

   * close always happens after open started retrying.
   */
  @Test
  public void testHdfsDownInterruptAfterOpeningRetry()
      throws FlumeSpecException, IOException, InterruptedException {
    final EventSink snk = new LazyOpenDecorator(FlumeBuilder.buildSink(
        new Context(),
        "collectorSink(\"hdfs://nonexistant/user/foo\", \"foo\")"));

    final CountDownLatch started = new CountDownLatch(1);
    final CountDownLatch done = new CountDownLatch(1);

    Thread t = new Thread("append thread") {
      public void run() {
        Event e = new EventImpl("foo".getBytes());
        try {
          snk.open();
          started.countDown();
          snk.append(e);
        } catch (IOException e1) {
          // could throw exception but we don't care
          LOG.info("don't care about this exception: ", e1);
        }
        done.countDown();
      }
    };
    t.start();
    boolean begun = started.await(60, TimeUnit.SECONDS);
    Clock.sleep(10);
    assertTrue("took too long to start", begun);
    snk.close();
    LOG.info("Interrupting appending thread");
    t.interrupt();
    boolean completed = done.await(60, TimeUnit.SECONDS);
    assertTrue("Timed out when attempting to shutdown", completed);
  }
View Full Code Here

Examples of com.cloudera.flume.handlers.debug.LazyOpenDecorator

  final long checkmillis;

  public DiskFailoverDeco(S s, final DiskFailoverManager dfoman, RollTrigger t,
      long checkmillis) {
    super((S) new LazyOpenDecorator(s));
    this.dfoMan = dfoman;
    this.trigger = t;
    this.checkmillis = checkmillis;
  }
View Full Code Here

Examples of com.cloudera.flume.handlers.debug.LazyOpenDecorator

    this.trigger = t;
    this.checkmillis = checkmillis;
  }

  public void setSink(S sink) {
    this.sink = (S) new LazyOpenDecorator(sink);
  }
View Full Code Here

Examples of com.cloudera.flume.handlers.debug.LazyOpenDecorator

    this.trigger = t;
    this.queuer = new AckListener.Empty();
    this.al = al;
    // TODO get rid of this cast.
    this.drainSink = (EventSinkDecorator<S>) new EventSinkDecorator(
        new LazyOpenDecorator(new AckChecksumRegisterer<S>(s, al)));
    this.checkMs = checkMs;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.