Skip to content

Instantly share code, notes, and snippets.

@AlexeySoshin
Created September 3, 2017 16:26
Show Gist options
  • Save AlexeySoshin/0ce4a454ded86b6497b071aaafa38505 to your computer and use it in GitHub Desktop.
Save AlexeySoshin/0ce4a454ded86b6497b071aaafa38505 to your computer and use it in GitHub Desktop.
ExecutorService executor = Executors.newFixedThreadPool(4);
for (int i = 0; i < 10; i++) {
executor.execute(() -> {
//No Java without boilerplate!
try {
Thread.sleep(1000);
} catch (InterruptedException e) {}
System.out.println("Finished");
});
}
executor.shutdown();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment