Java SE 8 was officially released yesterday (March 18th) and given the fact that Java 7 was released back in 2012, there are definitely lots of updates and new features. These updates include improvements to the Java language itself, Java security, Java tools and more. Although a lot of these updates are interesting and important I am specifically interesting in exploring: What’s new for concurrency?
Based on the release notes the concurrency-related additions are:
- New forEach, search and reduction methods in
java.util.concurrent.ConcurrentHashMap
- New accumulator and adder classes for double and long types in the
java.util.concurrent.atomic
package. According to the release notes, these new classes
“…internally employ contention-reduction techniques that provide huge throughput improvements as compared to
Atomic
variables.”
- A new StampedLock class in the
java.util.concurrent.locks
package which allows for writing, reading, and optimistic reading access to shared data - New methods to support a “common pool” in
java.util.concurrent.ForkJoinPool
- A number of new classes and interfaces in
java.util.concurrent
to support asynchronous tasks and computation as well as completion actions - The addition of parallel array sorting methods to the
java.util.Arrays
package (using the Fork/Join framework)
The complete Java SE 8 release notes are available here and complete details on the concurrency enhancements are available here.