本文整理汇总了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;
}
示例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) {
}
}
}
}
示例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));
}
}
示例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);
}