O'Reilly logo

Mastering Concurrency Programming with Java 8 by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Additional information about executors

In this chapter, we have extended ThreadPoolExecutor and the ScheduledThreadPoolExecutor class and overridden some of their methods. But you can override more methods if you want a more particular behavior. These are some methods you can override:

  • shutdown(): You must explicitly call this method to end the execution of the executor. You can override it to add some code to free additional resources used by your own executor.
  • shutdownNow(): The difference between shutdown() and shutdownNow() is that the shutdown() method waits for the finalization of all the tasks that are waiting in the executor.
  • submit(), invokeall(), or invokeany(): you call these methods to send concurrent tasks to the executor. You can override ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required