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


Java Status类代码示例

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


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

示例1: append

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent avroEvent) {
  logger.debug("Avro source {}: Received avro event: {}", getName(),
      avroEvent);
  sourceCounter.incrementAppendReceivedCount();
  sourceCounter.incrementEventReceivedCount();

  Event event = EventBuilder.withBody(avroEvent.getBody().array(),
      toStringMap(avroEvent.getHeaders()));

  try {
    getChannelProcessor().processEvent(event);
  } catch (ChannelException ex) {
    logger.warn("Avro source " + getName() + ": Unable to process event. " +
        "Exception follows.", ex);
    return Status.FAILED;
  }

  sourceCounter.incrementAppendAcceptedCount();
  sourceCounter.incrementEventAcceptedCount();

  return Status.OK;
}
 
开发者ID:srotya,项目名称:marauder,代码行数:24,代码来源:MarauderLFSource.java

示例2: append

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
  if (failed) {
    logger.debug("Event rejected");
    return Status.FAILED;
  }
  logger.debug("LB: Received event from append(): {}",
      new String(event.getBody().array(), Charset.forName("UTF8")));
  appendCount++;
  return Status.OK;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:12,代码来源:RpcTestUtils.java

示例3: appendBatch

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) throws
    AvroRemoteException {
  if (failed) {
    logger.debug("Event batch rejected");
    return Status.FAILED;
  }
  logger.debug("LB: Received {} events from appendBatch()",
      events.size());

  appendBatchCount++;
  return Status.OK;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:14,代码来源:RpcTestUtils.java

示例4: append

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent avroEvent) {
  if (logger.isDebugEnabled()) {
    if (LogPrivacyUtil.allowLogRawData()) {
      logger.debug("Avro source {}: Received avro event: {}", getName(), avroEvent);
    } else {
      logger.debug("Avro source {}: Received avro event", getName());
    }
  }

  sourceCounter.incrementAppendReceivedCount();
  sourceCounter.incrementEventReceivedCount();

  Event event = EventBuilder.withBody(avroEvent.getBody().array(),
      toStringMap(avroEvent.getHeaders()));

  try {
    getChannelProcessor().processEvent(event);
  } catch (ChannelException ex) {
    logger.warn("Avro source " + getName() + ": Unable to process event. " +
        "Exception follows.", ex);
    return Status.FAILED;
  }

  sourceCounter.incrementAppendAcceptedCount();
  sourceCounter.incrementEventAcceptedCount();

  return Status.OK;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:30,代码来源:AvroSource.java

示例5: appendBatch

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
  logger.debug("Avro source {}: Received avro event batch of {} events.",
      getName(), events.size());
  sourceCounter.incrementAppendBatchReceivedCount();
  sourceCounter.addToEventReceivedCount(events.size());

  List<Event> batch = new ArrayList<Event>();

  for (AvroFlumeEvent avroEvent : events) {
    Event event = EventBuilder.withBody(avroEvent.getBody().array(),
        toStringMap(avroEvent.getHeaders()));

    batch.add(event);
  }

  try {
    getChannelProcessor().processEventBatch(batch);
  } catch (Throwable t) {
    logger.error("Avro source " + getName() + ": Unable to process event " +
        "batch. Exception follows.", t);
    if (t instanceof Error) {
      throw (Error) t;
    }
    return Status.FAILED;
  }

  sourceCounter.incrementAppendBatchAcceptedCount();
  sourceCounter.addToEventAcceptedCount(events.size());

  return Status.OK;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:33,代码来源:AvroSource.java

示例6: testProcess

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Test
public void testProcess() throws InterruptedException,
    EventDeliveryException, InstantiationException, IllegalAccessException {
  setUp();

  Event event = EventBuilder.withBody("test event 1", Charsets.UTF_8);
  Server server = createServer(new MockAvroServer());

  server.start();

  sink.start();
  Assert.assertTrue(LifecycleController.waitForOneOf(sink,
      LifecycleState.START_OR_ERROR, 5000));

  Transaction transaction = channel.getTransaction();

  transaction.begin();
  for (int i = 0; i < 10; i++) {
    channel.put(event);
  }
  transaction.commit();
  transaction.close();

  for (int i = 0; i < 5; i++) {
    Sink.Status status = sink.process();
    Assert.assertEquals(Sink.Status.READY, status);
  }

  Assert.assertEquals(Sink.Status.BACKOFF, sink.process());

  sink.stop();
  Assert.assertTrue(LifecycleController.waitForOneOf(sink,
      LifecycleState.STOP_OR_ERROR, 5000));

  server.close();
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:37,代码来源:TestAvroSink.java

示例7: appendBatch

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events)
    throws AvroRemoteException {
  logger.debug("Received event batch:{}; delaying for {}ms", events, delay);
  sleep();
  return Status.OK;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:8,代码来源:TestAvroSink.java

示例8: append

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent avroEvent) {
  if (isFail) {
    return Status.FAILED;
  }
  appendCount.incrementAndGet();
  return super.append(avroEvent);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:9,代码来源:TestLoadBalancingLog4jAppender.java

示例9: appendBatch

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
  if (isFail) {
    return Status.FAILED;
  }
  appendCount.addAndGet(events.size());
  return super.appendBatch(events);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:9,代码来源:TestLoadBalancingLog4jAppender.java

示例10: appendBatch

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
  logger.debug("Avro source {}: Received avro event batch of {} events.",
      getName(), events.size());
  sourceCounter.incrementAppendBatchReceivedCount();
  sourceCounter.addToEventReceivedCount(events.size());

  List<Event> batch = new ArrayList<Event>();

  for (AvroFlumeEvent avroEvent : events) {
    Event event = EventBuilder.withBody(avroEvent.getBody().array(),
        toStringMap(avroEvent.getHeaders()));

    batch.add(event);
  }

  try {
    getChannelProcessor().processEventBatch(batch);
  } catch (Throwable t) {
    logger.error("Avro source " + getName() + ": Unable to process event " +
        "batch. Exception follows.", t);
    if (t instanceof Error) {
      throw (Error) t;
    }
    return Status.FAILED;
  }
  sourceCounter.incrementAppendBatchAcceptedCount();
  sourceCounter.addToEventAcceptedCount(events.size());
  return Status.OK;
}
 
开发者ID:srotya,项目名称:marauder,代码行数:31,代码来源:MarauderLFSource.java

示例11: start

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
private void start() {
  flumeServer = RpcTestUtils.startServer(new AvroSourceProtocol(){

    @Override
    public Status append(AvroFlumeEvent event) throws AvroRemoteException {
      return protocol.append(event);
    }

    @Override
    public Status appendBatch(List<AvroFlumeEvent> events) throws AvroRemoteException {
      return protocol.appendBatch(events);
    }
  });
}
 
开发者ID:apache,项目名称:incubator-htrace,代码行数:15,代码来源:FakeFlume.java

示例12: appendBatch

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) throws
    AvroRemoteException {
  LOG.info("Failed: Received {} events from appendBatch()",
      events.size());
  return Status.FAILED;
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:8,代码来源:AvroAsyncRpcClientTest.java

示例13: append

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
  LOG.info("OK Sleep: Received event from append(): {}",
      new String(event.getBody().array(), Charset.forName("UTF8")));
  try {
    Thread.sleep(sleepTime);
  } catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return Status.OK;
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:13,代码来源:AvroAsyncRpcClientTest.java

示例14: appendBatch

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
/**
 * Sends the AvroFlumeEvents from it's argument list to the Apache Flink
 * {@link DataStream}.
 * 
 * @param events
 *            The events that is sent to the dataStream
 * @return A Status.OK message if sending the events was successful.
 */
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
	for (AvroFlumeEvent avroEvent : events) {
		collect(avroEvent);
	}

	return Status.OK;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:17,代码来源:FlumeSource.java

示例15: appendBatch

import org.apache.flume.source.avro.Status; //导入依赖的package包/类
@Override
public Status appendBatch(final List<AvroFlumeEvent> events) throws AvroRemoteException {
    Preconditions.checkState(eventQueue.addAll(events));
    for (final AvroFlumeEvent event : events) {
        // System.out.println("Received event " + event.getHeaders().get(new org.apache.avro.util.Utf8(FlumeEvent.GUID)));
    }
    return Status.OK;
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:9,代码来源:FlumePersistentAppenderTest.java


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