Skip to content

Instantly share code, notes, and snippets.

@yashb042
Last active February 3, 2023 10:57
Show Gist options
  • Save yashb042/02018634c480142dbf586c95fb5cb92d to your computer and use it in GitHub Desktop.
Save yashb042/02018634c480142dbf586c95fb5cb92d to your computer and use it in GitHub Desktop.
void runConventional() throws Exception {
for (; ; ) {
long start = System.currentTimeMillis();
try (var executor = Executors.newFixedThreadPool(1000)) {
for (int i = 0; i < 100_000_0; i++) {
executor.submit(() -> {
callExternalService();
return null;
});
}
}
long end = System.currentTimeMillis();
System.out.println(end - start + " ms");
}
}
private void callExternalService() throws InterruptedException {
Thread.sleep(Duration.ofMillis(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment