Exemple #1
0
 public void manage(MessageBean bean) {
   FixedQueue queue = getAndInitQueue();
   if (queue == null) {
     return;
   }
   queue.add(bean);
   ConfigurationVO vo = cfgVO;
   if (vo != null) {
     Set<Filter> filterSet = vo.getFilterSet();
     if (filterSet != null) {
       for (Filter filter : filterSet) {
         boolean ifContinue = filter.doFilter(bean);
         if (!ifContinue) {
           return;
         }
       }
     }
     long total = FixedQueue.getCharTotal();
     long bufferSize = vo.getBufferSize();
     if (total >= bufferSize) {
       IMemoryManager manager = vo.getMemoryManager();
       manager.manager(queue);
     }
   }
 }
Exemple #2
0
 /**
  * 判断是否需要处理level级别的数据
  *
  * @param level
  * @return
  */
 public boolean isEnabled(Level level) {
   boolean enable = false;
   ConfigurationVO vo = cfgVO;
   if (vo != null) {
     Level threshold = vo.getMinThreshold();
     enable = threshold.isEnabled(level);
   }
   return enable;
 }
Exemple #3
0
 /**
  * 获取queue,如果没有queue,则初始化queue<br>
  * 懒加载queueLocal
  *
  * @return
  */
 private FixedQueue getAndInitQueue() {
   FixedQueue queue = QUEUE_LOCAL.get();
   if (queue != null) {
     return queue;
   }
   ConfigurationVO vo = cfgVO;
   if (vo == null) {
     return null;
   }
   int count = vo.getCount();
   queue = new FixedQueue(count);
   QUEUE_LOCAL.set(queue);
   return queue;
 }
Exemple #4
0
 static {
   String path = System.getProperty(CONFIGURATION_PATH);
   if (path == null) {
     path = DEFAULT_CONFIGURATION_FILE;
   } else {
     path = path.trim();
     LogHelper.debug("Using path [" + path + "] for eslf4j configuration.");
   }
   cfgVO = FileReader.loadFile(path);
   ConfigurationVO vo = cfgVO;
   if (vo == null) {
     throw new Eslf4jConfigurationException("ConfigurationVO is null");
   }
   vo.init();
 }