예제 #1
0
 @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
 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);
   }
 }