Skip to main content

Concurrency Utilities

Posted by daniel on March 1, 2004 at 3:45 AM PST

Generics, the enhanced for loop, meta-data and other related features are getting all of the press for J2SE 1.5, but with Tiger you are also getting a new concurrency package.

Brian Goetz previews what's coming in Today's Featured Articles . In Brian's A First Look at JSR 166: Concurrency Utilities , he provides background for the JSR and an overview of the improvements you will find. Doug Lea influenced the spec in two important ways. First. his util.concurrent package formed the base for the spec and second he involved the public in the process with "a public mailing list, concurrency-interest, to which frequent API snapshots were posted and from which opinions were solicited. This allowed knowledgeable outsiders to comment and make suggestions -- many of which were very useful -- without bogging down the process, and it also allowed the expert group to consider public input far earlier in the process, before decisions were set in stone." This has led to the changes in the JCP that you will soon see in version 2.6.

Goetz explains that "The goal of JSR 166 is, immodestly, to do for concurrency what the Java Collections Framework did for data structures." In an analagous way, the new concurrency utilities supplement the "low-level facilities for concurrency -- synchronized, volatile, wait(), notify(), and notifyAll() -- [with] higher-level constructs, such as concurrent collections, thread pools, semaphores, and explicit lock and condition objects." Goetz predicts that "Using the concurrency utilities will, in most cases, make your programs clearer, shorter, faster, easier to write, easier to read, more reliable, and more scalable. This is possible because most concurrent applications use the same common building blocks -- concurrent collections, thread pools, semaphores, and the like. "

In today's
Weblogs , Manoel Lemos writes More about JAVA and XML on the Brazilian National Health Card Project. He links to a paper which details the Java and XML implementation. "The Brazilian National Health Card Project is a huge project with the objective of building a huge repository of clinical data for the Brazilian Health Care System. This project was constructed with the support of two fundamental technologies: JAVA and XML."

Malcolm Davis suggests that you Adapt the Java style for your own . He recalls coming from C/C++ to Java and initially fighting Sun's Code Conventions for Java. It required reformatting existing Java code and making a mental jump between code styled using different conventions. Malcolm advocates a single coding standard for a team and credits Bruce Eckel with encouraging him to adopt Sun's standard. Already in the talkback, a reader counters that these standards "are derived from an antiquated and BAD way of coding." Your thoughts?

Bob Lee provides a a few tricks to creating performant and maintainable tests for DAO design in his blog entry Design and Test JDBC Code . Rather than use mock objects, he prefers "to test against hsqldb, a lightweight 100% Java database engine that can run completely in memory. I can set up and destroy the entire database within the scope of a single test. Keeping database agnostic (so I can test against hsqldb and still use Oracle in production) can be trying at times but is well worth the effort. My tests set up a minimal database (i.e. only what's needed by the test) and execute commands against it".

Also in Java Today
, enjoy three sample recipes from Bruce Perry's Cooking with Java Servlets & JSP. These tips demonstrate Embedding an Applet in a JSP Using the HTML Converter, Configuring a DataSource in Tomcat, and Using the XML Transform Tags.

John Zukowski details all of your options in Beyond the basics of JOptionPane . What makes the JOptionPane tricky to use is the same class is used to specify Message Dialogs, Confirm Dialogs, Input Dialogs, and Option Dialogs. You determine which type is created with one of seven constructors or with factory methods. There are more than two dozen constants defined in the class used to specify some of the options (such as OK_CANCEL_OPTION) and return values (such as CANCEL_OPTION). John's walk through the JavaDocs should make everything clear.

In today's Projects and Communities , James Todd invites you to the next JXTA user group meeting in person or on the phone on Thursday, March 18 4pm PST in Santa Clara, CA.

The JavaPedia describes meaning and use of ClassPath and links to other articles on how classes are found and platform specific advice on setting the classpath.

In today's News Headlines

Registered users can submit news items for the href=""> News Page using
our news submission
. All submissions go through an editorial review by news director
Steve Mallet before being posted to the site. You can also subscribe to
News RSS feed

Current and upcoming
Java Events

Registered users can submit event listings for the href=""> Events Page using our href=""> events submission
form. All submissions go through an editorial review before being
posted to the site.

Archives and Subscriptions: This blog is delivered weekdays as the
Today RSS feed
. All members can subscribe to the email
updates for the site at the href="">
java-net Mailing Lists page. You must be logged in to subscribe
the javanet_Daily and javanet_Weekly lists. Also, once this page
is no longer featured as the front page of
it will be archived along with other past issues in the href=""> Archive.