@Test public void testSubmitThreadPoolExecutorParameters() { ThreadPoolExecutor threadPoolExecutor = mock(MDCCleanerScheduledExecutor.class); when(threadPoolExecutor.getCorePoolSize()).thenReturn(5); var blockingQueue = mock(BlockingQueue.class); when(blockingQueue.size()).thenReturn(6); when(threadPoolExecutor.getQueue()).thenReturn(blockingQueue); when(threadPoolExecutor.getCompletedTaskCount()).thenReturn(7L); when(threadPoolExecutor.getActiveCount()).thenReturn(8); underTest.submitThreadPoolExecutorParameters(threadPoolExecutor); verify(metricService).submit(MetricType.THREADPOOL_ACTIVE_THREADS, 8); verify(metricService).submit(MetricType.THREADPOOL_TASKS_COMPLETED, 7L); verify(metricService).submit(MetricType.THREADPOOL_QUEUE_SIZE, 6); verify(metricService).submit(MetricType.THREADPOOL_THREADS_TOTAL, 5); }
public void submitThreadPoolExecutorParameters(ExecutorService executorService) { MDCCleanerScheduledExecutor threadPoolExecutor = (MDCCleanerScheduledExecutor) executorService; metricService.submit(THREADPOOL_THREADS_TOTAL, threadPoolExecutor.getCorePoolSize()); metricService.submit(THREADPOOL_QUEUE_SIZE, threadPoolExecutor.getQueue().size()); metricService.submit(THREADPOOL_TASKS_COMPLETED, threadPoolExecutor.getCompletedTaskCount()); metricService.submit(THREADPOOL_ACTIVE_THREADS, threadPoolExecutor.getActiveCount()); }
MetricUtils { public void submitThreadPoolExecutorParameters(ExecutorService executorService) { MDCCleanerScheduledExecutor threadPoolExecutor = (MDCCleanerScheduledExecutor) executorService; metricService.submit(THREADPOOL_THREADS_TOTAL, threadPoolExecutor.getCorePoolSize()); metricService.submit(THREADPOOL_QUEUE_SIZE, threadPoolExecutor.getQueue().size()); metricService.submit(THREADPOOL_TASKS_COMPLETED, threadPoolExecutor.getCompletedTaskCount()); metricService.submit(THREADPOOL_ACTIVE_THREADS, threadPoolExecutor.getActiveCount()); } }
MetricUtils { public void submitThreadPoolExecutorParameters(ExecutorService executorService) { MDCCleanerScheduledExecutor threadPoolExecutor = (MDCCleanerScheduledExecutor) executorService; metricService.submit(THREADPOOL_THREADS_TOTAL, threadPoolExecutor.getCorePoolSize()); metricService.submit(THREADPOOL_QUEUE_SIZE, threadPoolExecutor.getQueue().size()); metricService.submit(THREADPOOL_TASKS_COMPLETED, threadPoolExecutor.getCompletedTaskCount()); metricService.submit(THREADPOOL_ACTIVE_THREADS, threadPoolExecutor.getActiveCount()); }  }
MetricUtils { public void submitThreadPoolExecutorParameters(ExecutorService executorService) { MDCCleanerScheduledExecutor threadPoolExecutor = (MDCCleanerScheduledExecutor) executorService; metricService.submit(THREADPOOL_THREADS_TOTAL, threadPoolExecutor.getCorePoolSize()); metricService.submit(THREADPOOL_QUEUE_SIZE, threadPoolExecutor.getQueue().size()); metricService.submit(THREADPOOL_TASKS_COMPLETED, threadPoolExecutor.getCompletedTaskCount()); metricService.submit(THREADPOOL_ACTIVE_THREADS, threadPoolExecutor.getActiveCount()); }  void submitThreadPoolExecutorParameters(ExecutorService executorService); }
MetricUtils { public void submitThreadPoolExecutorParameters(ExecutorService executorService) { MDCCleanerScheduledExecutor threadPoolExecutor = (MDCCleanerScheduledExecutor) executorService; metricService.submit(THREADPOOL_THREADS_TOTAL, threadPoolExecutor.getCorePoolSize()); metricService.submit(THREADPOOL_QUEUE_SIZE, threadPoolExecutor.getQueue().size()); metricService.submit(THREADPOOL_TASKS_COMPLETED, threadPoolExecutor.getCompletedTaskCount()); metricService.submit(THREADPOOL_ACTIVE_THREADS, threadPoolExecutor.getActiveCount()); }  void submitThreadPoolExecutorParameters(ExecutorService executorService);  }