top of page
Books, courses and notes

Java Multithreading with Thread API and Executors Framework


Hey guys, what's up?

Recently I've been creating more than 20 simple code examples to illustrate how to use the Java API and Executors Framework and I'd like to share it with you and also ask your help to contribute to it forking my GitHub Repository and creating more simple Java Thread examples (Fork/Join Framework simple examples would be very welcome as well).

Some of the subjects already covered in the code examples includes:

  • Running tasks from Thread and Runnable

  • Strategies for returning values from Threads and Runnable tasks

  • wait(), notify(), interrupt(), join(), isAlive()...

  • Creating Thread Pools (FixedThreadPool, CachedThreadPool, SingleThreadPool, ScheduledThreadPool...)

  • Submiting tasks to ExecutorService

  • Returning values from tasks using Callable and Future

  • Naming threads and creating deamon threads in a thread pool implementing ThreadFactory interface

  • Terminating tasks using Thread API

  • Terminating tasks using Future

  • Handling exceptions in normal threads implementing UncaughtExceptionHandler interface

  • Handling exceptions in threads on a thread pool implementing UncaughtExceptionHandler interface

  • Managing tasks termination using CountDownLatch

  • Running scheduled tasks using Timer and TimerTask

  • Running scheduled tasks using ScheduledThreadPool

I hope you enjoy playing with it and let me know if there are any doubts.​

Comments


bottom of page