Untitled

 avatar
unknown
plain_text
a year ago
494 B
4
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