Java concurrency utilities are used to make a program fast, reliable, easy to maintain and are simpler to debug. With concurrency utilities, a developer does not need to develop a standard class.
Java concurrency utilities are classes used as building blocks in building concurrent classes or applications. Using it to implement a concurrent application makes a program short, fast, easier to write, read and maintain.
Java concurrency utilities simplify the development of concurrent classes by providing implementations of building blocks.
The new Java concurrency utilities have:
- High-performance
- Thread pool
- Framework for Asynchronous execution of tasks
- Collection Classes optimized for Concurrent Access
- Synchronization Utilities
- Atomic Variables
- Locks
- Condition Variables
Advantages of Concurrency utilities:
- With Java Concurrency utilities, it is very easy to programs as you don't need to develop a standard class, just use it.
- The implementations in the concurrency utilities are faster and more scalable than a typical implementation.
- Developers can easily understand and maintain programs that use standard library classes.
- Concurrent applications are simpler to debug.
The changes and improvement in Java Concurrency Utilities:
- fork/join framework is added to run various tasks using a pool of worker threads and multiple processors. Class ForkJoinPool extends AbstractExecutorService and implements Executor interface, only difference being work-stealing.
A "work-stealing" technique keeps all the worker threads busy as every thread tries to find and execute subtasks created by other active tasks.
- ThreadLocalRandom class uses pseudo-random numbers to end competition among threads
- Phaser class is a new synchronization barrie