コード例 #1
0
ファイル: FlumeLogAppender.java プロジェクト: RackyRose/kaa
 @Override
 protected void initFromConfiguration(LogAppenderDto appender, FlumeConfig configuration) {
   LOG.debug("Initializing new instance of Flume log appender");
   try {
     this.configuration = configuration;
     flumeEventBuilder = new FlumeAvroEventBuilder();
     flumeEventBuilder.init(configuration);
     int executorPoolSize =
         Math.min(configuration.getExecutorThreadPoolSize(), MAX_CALLBACK_THREAD_POOL_SIZE);
     int callbackPoolSize =
         Math.min(configuration.getCallbackThreadPoolSize(), MAX_CALLBACK_THREAD_POOL_SIZE);
     executor = Executors.newFixedThreadPool(executorPoolSize);
     callbackExecutor = Executors.newFixedThreadPool(callbackPoolSize);
     flumeClientManager = FlumeClientManager.getInstance(configuration);
   } catch (Exception e) {
     LOG.error("Failed to init Flume log appender: ", e);
   }
 }
コード例 #2
0
ファイル: FlumeLogAppender.java プロジェクト: RackyRose/kaa
 @Override
 public void close() {
   if (!closed) {
     closed = true;
     if (flumeClientManager != null) {
       flumeClientManager.cleanUp();
     }
     if (executor != null) {
       executor.shutdownNow();
     }
     if (callbackExecutor != null) {
       callbackExecutor.shutdownNow();
     }
     if (scheduler != null) {
       scheduler.shutdownNow();
     }
     flumeClientManager = null;
   }
   LOG.debug("Stoped Flume log appender.");
 }
コード例 #3
0
ファイル: FlumeLogAppender.java プロジェクト: RackyRose/kaa
 public void reinit() {
   if (configuration == null) {
     LOG.warn(
         "Flume configuration wasn't initialized. Invoke method init with configuration before.");
     return;
   }
   if (flumeEventBuilder == null) {
     flumeEventBuilder = new FlumeAvroEventBuilder();
     flumeEventBuilder.init(configuration);
   }
   if (executor == null) {
     int executorPoolSize =
         Math.min(configuration.getExecutorThreadPoolSize(), MAX_CALLBACK_THREAD_POOL_SIZE);
     executor = Executors.newFixedThreadPool(executorPoolSize);
   }
   if (callbackExecutor == null) {
     int callbackPoolSize =
         Math.min(configuration.getCallbackThreadPoolSize(), MAX_CALLBACK_THREAD_POOL_SIZE);
     callbackExecutor = Executors.newFixedThreadPool(callbackPoolSize);
   }
   if (flumeClientManager == null) {
     flumeClientManager = FlumeClientManager.getInstance(configuration);
   }
 }