Last active
February 3, 2023 10:57
-
-
Save yashb042/02018634c480142dbf586c95fb5cb92d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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