Re: JavaMemoryModel: Threading issues in my connection pool

From: Joseph Bowbeer (jozart@csi.com)
Date: Thu Sep 07 2000 - 07:38:11 EDT


----- Original Message -----
From: "Bill Pugh" <pugh@cs.umd.edu>
To: "David W. Smiley" <dsmiley@mitre.org>; "Jeremy Manson"
<jmanson@cs.umd.edu>
Cc: <javamemorymodel@cs.umd.edu>
Sent: Wednesday, September 06, 2000 1:52 PM
Subject: Re: JavaMemoryModel: Threading issues in my connection pool

> Use synchronization and/or volatile
> (once we get volatile fixed). It isn't that
> expensive, and it serves as important and
> useful documentation to programmers
> about the intended thread interactions
> in your code.
>

I agree, though I think 'synchronized' and 'volatile' and 'wait' and
'notify' have all the finesse of assembler directives compared to the
rest of Java. They're better than nothing, but except in the
implementation of low-level utilities, I encourage the use of
higher-level constructs such as FutureResult and ReadWriteLock and
SynchronizedVar (from Doug Lea's util.concurrent package).

I might recommend JCSP, too, if I were more familiar with it.

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:27 EDT