Created
September 3, 2017 16:26
-
-
Save AlexeySoshin/0ce4a454ded86b6497b071aaafa38505 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
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