HBaseEventBuffer.java 757 B

12345678910111213141516171819202122232425262728293031
  1. package com.yihu.base.hbase.buffer;
  2. import ch.qos.logback.classic.spi.LoggingEvent;
  3. import com.yihu.base.hbase.properties.BufferProperties;
  4. import java.util.concurrent.ArrayBlockingQueue;
  5. import java.util.concurrent.BlockingQueue;
  6. /**
  7. * Created by chenweida on 2018/2/24.
  8. */
  9. public class HBaseEventBuffer {
  10. //缓冲队列
  11. BlockingQueue queue = null;
  12. public HBaseEventBuffer(BufferProperties bufferProperties) {
  13. queue = new ArrayBlockingQueue(bufferProperties.getBufferSize());
  14. }
  15. public BlockingQueue getBuffer() {
  16. return queue;
  17. }
  18. public void setQueue(BlockingQueue queue) {
  19. this.queue = queue;
  20. }
  21. public void addLogEvent(LoggingEvent eventObject) {
  22. queue.add(eventObject);
  23. }
  24. }