/** * Default constructor. */ public EventPublisher(int queueCapacity, int poolSize, EventRepository er, long submitTimeout) { // Initializing queue final BlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(queueCapacity); // Executor with worker to process threads RejectedExecutionHandler rej = new EventRejectedExecutionHandler(); ThreadFactory tFactorty = new PublisherThreadFactory(); this.executor = new ThreadPoolExecutor(poolSize, poolSize, 0L, TimeUnit.MILLISECONDS, queue, tFactorty, rej); // Override repository this.repository = er; this.submitTimeout = submitTimeout; this.shutdownExecutor = true; }