Untitled
unknown
plain_text
2 years ago
494 B
11
Indexable
private void sendAllEmails(List<String> emails) throws InterruptedException {
ExecutorService executorService;
executorService = Executors.newFixedThreadPool(2);
emails.forEach(email ->
executorService.submit(() ->
sendEmail(email)));
log.info("Tasks submitted...")
}
void printSum(Server server) {
try {
int sum = sendAllEmails(server);
System.out.println("Sum: " + sum);
} catch (InterruptedException e) {
}
}Editor is loading...
Leave a Comment