robobario commented on PR #13404: URL: https://github.com/apache/kafka/pull/13404#issuecomment-1472733211
> @robobario please take a look if you have free cycle. LGTM. If you expose the internals of `Stats` a bit more we could test it with something like: ``` @Test public void testStatsThreading() throws Exception { ExecutorService singleThreaded = Executors.newSingleThreadExecutor(); final int numRecords = 1000000; ProducerPerformance.Stats stats = new ProducerPerformance.Stats(numRecords, 5000); for (int i = 0; i < numRecords; i++) { final Callback callback = stats.nextCompletion(0, 100); CompletableFuture.runAsync(() -> { callback.onCompletion(null, null); }, singleThreaded); } singleThreaded.shutdown(); final boolean success = singleThreaded.awaitTermination(60, TimeUnit.SECONDS); assertTrue(success, "should have terminated"); assertEquals(numRecords, stats.totalCount()); assertEquals(numRecords, stats.iteration()); assertEquals(500000, Arrays.stream(stats.latencies()).filter(value -> value != 0).count()); } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org