Skip to main content

JXSE 2.5 : What's Cool #5 -- java.util.concurrent

Posted by bondolo on September 20, 2007 at 2:03 PM PDT

JXSE (JXTA for Java SE/EE 5.0) 2.5 contains quite a number of exciting changes for JXTA application developers. This little series will look at a few of the important changes in the upcoming release.

JXSE 2.4 was the first version to require Java Standard Edition 5.0. For that release we used only a small amount of JSE 5 specific functionality. The requirement of JSE 5.0 was primarily about advancing the support matrix to include the then newly released JSE 6 and providing the opportunity to take advantage of new features in future releases. In JXSE 2.4.1 we started to make much greater use of JSE 5.0 specific APIs, and most significantly the new java.util.concurrent utilities. In JXSE 2.5 we have continued to make much greater use throughout the JXSE source.

The use of the java.util.concurrent package, also known as the JSR-166 utilities, within JXSE 2.5 has been primarily about simplifying the implementation, obsoleting use of JXSE private utilities (mostly net.jxta.impl.util.UnbiasedQueue) and improving performance by allowing greater concurrency. By making use of the concurrency utilities in JXSE 2.5 the implementation is easier to understand, debug and extend. Use of ConcurrentHashMap has been particularly useful in simplifying several areas which where very complicated due to concurrency requirements.

We have also found the java.util.concurrent.atomic utilities very useful for simplifying code which required atomic counters and atomic booleans. In a few places we have started to use the java.util.concurrent.locks utilities and expect that future versions of JXSE will make more use of these utilities.

The next entry in this series will talk about JXSE 2.5's use of the java.util.concurrent Executor and ScheduledExecutor.