本文整理汇总了Java中org.apache.flume.channel.ChannelProcessor.close方法的典型用法代码示例。如果您正苦于以下问题:Java ChannelProcessor.close方法的具体用法?Java ChannelProcessor.close怎么用?Java ChannelProcessor.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flume.channel.ChannelProcessor
的用法示例。
在下文中一共展示了ChannelProcessor.close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.apache.flume.channel.ChannelProcessor; //导入方法依赖的package包/类
@Override
public void stop() {
runner.shouldStop.set(true);
try {
runnerThread.interrupt();
runnerThread.join();
} catch (InterruptedException e) {
logger.warn("Interrupted while waiting for polling runner to stop. Please report this.", e);
Thread.currentThread().interrupt();
}
Source source = getSource();
source.stop();
ChannelProcessor cp = source.getChannelProcessor();
cp.close();
lifecycleState = LifecycleState.STOP;
}
示例2: stop
import org.apache.flume.channel.ChannelProcessor; //导入方法依赖的package包/类
@Override
public void stop() {
Source source = getSource();
source.stop();
ChannelProcessor cp = source.getChannelProcessor();
cp.close();
lifecycleState = LifecycleState.STOP;
}
示例3: testCensor
import org.apache.flume.channel.ChannelProcessor; //导入方法依赖的package包/类
@Test
public void testCensor() {
MemoryChannel memCh = new MemoryChannel();
memCh.configure(new Context());
memCh.start();
ChannelSelector cs = new ReplicatingChannelSelector();
cs.setChannels(Lists.<Channel>newArrayList(memCh));
ChannelProcessor cp = new ChannelProcessor(cs);
// source config
Map<String, String> cfgMap = Maps.newHashMap();
cfgMap.put("interceptors", "a");
String builderClass = CensoringInterceptor.Builder.class.getName();
cfgMap.put("interceptors.a.type", builderClass);
Context ctx = new Context(cfgMap);
// setup
cp.configure(ctx);
cp.initialize();
Map<String, String> headers = Maps.newHashMap();
String badWord = "scribe";
headers.put("Bad-Words", badWord);
Event event1 = EventBuilder.withBody("test", Charsets.UTF_8, headers);
Assert.assertEquals(badWord, event1.getHeaders().get("Bad-Words"));
cp.processEvent(event1);
Transaction tx = memCh.getTransaction();
tx.begin();
Event event1a = memCh.take();
Assert.assertNull(event1a.getHeaders().get("Bad-Words"));
tx.commit();
tx.close();
// cleanup / shutdown
cp.close();
memCh.stop();
}