Skip to content

Instantly share code, notes, and snippets.

@netopyr
Created March 13, 2017 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netopyr/e648d5600180c64a72a71cd66ce6ece1 to your computer and use it in GitHub Desktop.
Save netopyr/e648d5600180c64a72a71cd66ce6ece1 to your computer and use it in GitHub Desktop.
Example where a cached-thread-pool prevents immediate exit of the application
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class CachedThreads {
public static void main(String[] args) {
final ExecutorService executor = Executors.newCachedThreadPool();
executor.submit(() -> System.out.println("Hello World"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment