Github user toyboxman commented on a diff in the pull request: https://github.com/apache/incubator-griffin/pull/444#discussion_r230046860 --- Diff: service/src/main/java/org/apache/griffin/core/integration/GriffinEventListeners.java --- @@ -0,0 +1,61 @@ +package org.apache.griffin.core.integration; + +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +@Configuration +@ConfigurationProperties(prefix = "internal.event") +public class GriffinEventListeners { + private static final Logger LOGGER = LoggerFactory + .getLogger(GriffinEventListeners.class); + @Value("${internal.event.listeners}") + private String listeners; + + @Value("${internal.event.scheduler.thread.size}") + private int threadPoolSize; + + @Bean + public ThreadPoolTaskExecutor getListenersScheduler() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(threadPoolSize); + executor.setMaxPoolSize(threadPoolSize * 2); + executor.setThreadNamePrefix("event_listener_task_scheduler"); + executor.initialize(); + + return executor; + } + + @Bean + public List<GriffinHook> getListenersRegistered() { + ArrayList<GriffinHook> hookList = new ArrayList<>(); + if (listeners == null || listeners.isEmpty()) { + LOGGER.info("Disable griffin event listener for service."); + } else { + //split list of class name + Scanner scanner = new Scanner(listeners).useDelimiter(";"); --- End diff -- let me try it
---