Created
October 12, 2018 16:50
-
-
Save NikolayGorshkov/40142d6cebfd498bb8c73a4ef85dd81f to your computer and use it in GitHub Desktop.
Thread pool exceptions swallowing example
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
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
public class ThreadPoolExceptionExample { | |
public static void main(String[] args) throws Exception { | |
ExecutorService pool = Executors.newFixedThreadPool(1); | |
pool.submit(() -> { | |
throw new RuntimeException("You won't see this"); | |
}); | |
pool.shutdown(); | |
pool.awaitTermination(1, TimeUnit.DAYS); | |
System.out.println("DONE"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment