Skip to content

Instantly share code, notes, and snippets.

@nschlimm
Created March 22, 2012 10:13
Show Gist options
  • Save nschlimm/2157556 to your computer and use it in GitHub Desktop.
Save nschlimm/2157556 to your computer and use it in GitHub Desktop.
Custom thread pools
ThreadPoolExecutor pool =
new ThreadPoolExecutor(0, 50,
60, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>());
pool.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
ThreadPoolExecutor pool =
new ThreadPoolExecutor(50, 50,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(100000));
pool.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment