public NotificationProcessor(Environment env) { int numThreads = env.getConfiguration().getWorkerThreads(); this.env = env; this.queue = new LinkedBlockingQueue<>(); this.executor = new ThreadPoolExecutor(numThreads, numThreads, 0L, TimeUnit.MILLISECONDS, queue); this.tracker = new NotificationTracker(); this.observers = new Observers(env); env.getSharedResources().getMetricRegistry() .register(env.getMetricNames().getNotificationQueued(), new Gauge<Integer>() { @Override public Integer getValue() { return queue.size(); } }); }