diff --git a/clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java b/clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java index a902de0cce359..32669ff502247 100644 --- a/clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java +++ b/clients/src/test/java/org/apache/kafka/common/metrics/MetricsTest.java @@ -624,16 +624,15 @@ public void testConcurrentReadUpdate() throws Exception { final AtomicBoolean alive = new AtomicBoolean(true); executorService = Executors.newSingleThreadExecutor(); executorService.submit(new ConcurrentMetricOperation(alive, "record", new Runnable() { - @Override - public void run() { - while (alive.get()) { - for (Sensor sensor : sensors) { - sensor.record(random.nextInt(10000)); - } - } + @Override + public void run() { + while (alive.get()) { + for (Sensor sensor : sensors) { + sensor.record(random.nextInt(10000)); } - }) - ); + } + } + })); for (int i = 0; i < 10000; i++) { if (sensors.size() > 5) { @@ -708,28 +707,25 @@ public void run() { } } } - }) - ); + })); Future readFuture = executorService.submit(new ConcurrentMetricOperation(alive, "read", new Runnable() { - @Override - public void run() { - while (alive.get()) { - for (Sensor sensor : sensors) { - for (Metric metric : sensor.metrics()) { - assertNotNull("Invalid metric value", metric.metricValue()); - } - } + @Override + public void run() { + while (alive.get()) { + for (Sensor sensor : sensors) { + for (Metric metric : sensor.metrics()) { + assertNotNull("Invalid metric value", metric.metricValue()); } } - }) - ); + } + } + })); Future reportFuture = executorService.submit(new ConcurrentMetricOperation(alive, "report", new Runnable() { - @Override - public void run() { - reporter.processMetrics(); - } - }) - ); + @Override + public void run() { + reporter.processMetrics(); + } + })); for (int i = 0; i < 10000; i++) { if (sensors.size() > 10) {