O'Reilly logo

Java 9 Concurrency Cookbook - Second Edition 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

Introduction

Usually, when you develop a simple, concurrent programming application in Java, first you create some Runnable objects and then the corresponding Thread objects to execute them. If you have to develop a program that runs a lot of concurrent tasks, this approach will present the following disadvantages:

  • You will have to implement all of the code-related information to manage Thread objects (creating, ending, and obtaining results).
  • You will have to create a Thread object per task. Executing a huge number of tasks can affect the throughput of the application.
  • You will have to control and manage the resources of the computer efficiently. If you create too many threads, you could saturate the system.

Since Java 5, the Java concurrency ...

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