当前位置: 首页>>代码示例>>Java>>正文


Java PollableSource类代码示例

本文整理汇总了Java中org.apache.flume.PollableSource的典型用法代码示例。如果您正苦于以下问题:Java PollableSource类的具体用法?Java PollableSource怎么用?Java PollableSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PollableSource类属于org.apache.flume包,在下文中一共展示了PollableSource类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import org.apache.flume.PollableSource; //导入依赖的package包/类
@Override
public void start() {
  PollableSource source = (PollableSource) getSource();
  ChannelProcessor cp = source.getChannelProcessor();
  cp.initialize();
  source.start();

  runner = new PollingRunner();

  runner.source = source;
  runner.counterGroup = counterGroup;
  runner.shouldStop = shouldStop;

  runnerThread = new Thread(runner);
  runnerThread.setName(getClass().getSimpleName() + "-" + 
      source.getClass().getSimpleName() + "-" + source.getName());
  runnerThread.start();

  lifecycleState = LifecycleState.START;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:21,代码来源:PollableSourceRunner.java

示例2: run

import org.apache.flume.PollableSource; //导入依赖的package包/类
@Override
public void run() {
  run = true;
  while (run && count < until) {
    boolean error = true;
    try {
      if (PollableSource.Status.READY.equals(source.process())) {
        count++;
        error = false;
      }
    } catch (Exception ex) {
      errors.add(ex);
    }
    if (error) {
      try {
        Thread.sleep(1000L);
      } catch (InterruptedException e) {
      }
    }
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:22,代码来源:CountingSourceRunner.java

示例3: CountingSourceRunner

import org.apache.flume.PollableSource; //导入依赖的package包/类
public CountingSourceRunner(PollableSource source, int until, Channel channel) {
  this.source = source;
  this.until = until;
  if (channel != null) {
    ReplicatingChannelSelector selector = new ReplicatingChannelSelector();
    List<Channel> channels = Lists.newArrayList();
    channels.add(channel);
    selector.setChannels(channels);
    this.source.setChannelProcessor(new ChannelProcessor(selector));
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:12,代码来源:CountingSourceRunner.java

示例4: checkProcess

import org.apache.flume.PollableSource; //导入依赖的package包/类
@Test
public void checkProcess() throws EventDeliveryException {

    rest.configure(contextSource);
    rest.start();
    PollableSource.Status status = rest.process();
    rest.stop();
    Assert.assertEquals(status, PollableSource.Status.READY);
}
 
开发者ID:Stratio,项目名称:ingestion,代码行数:10,代码来源:RestSourceTest.java


注:本文中的org.apache.flume.PollableSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。