To join a mailing list discussing this JSR, go to: http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest .
This JSR focuses on creating APIs providing in-the-small frameworks, interfaces and implementations for commonly useful functionality. It also entails adding a few capablilities that cannot now be obtained in Java -- some new native methods that appear to be readily implementable on common JVMs/platforms. The APIs cover:
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/AtomicRef.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/AtomicInteger.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/AtomicLong.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/AtomicFloat.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/AtomicDouble.html
There's no reason to define versions of these classes for Boolean, Byte, Short, or Char. Since all implementations I know would need to reserve at least an int for CAS (or LL/SC or whatever), it would be useless and even deceptive to define these shorter types.
Also note that these classes do not strictly require JVM changes since it is possible to (more slowly) simulate effects via locks. The APIs would not strictly require lock-free implementations. However, we'd expect all JVMs capable of doing so to implement them using atomic instructions. On platforms that have CAS but not, say atomic-increment, "increment" operations would be done via CAS.
We need to decide whether and how to express DCAS (two-variable compare-and-swap). One solution is to support exactly three of the N^2 possible combinations (i.e., the ones that are actually known to be useful in non-blocking algorithms), in special CLASSES that can take two AtomicRefs, two AtomicIntegers, or a ref and int), and treat them as a DCAS-able pair. This isolates the time/space overhead of emulating DCAS using other instructions to applications that actually need it. This would involve a bit of VM trickery and some usage restrictions, but it would be worth it to get the functionality.
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/AtomicRefIntegerPair.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/AtomicRefPair.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/AtomicIntegerPair.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/NanoTimer.html
The API for nanosecond timing affects most other interfaces and classes. For this version I just have "Millis" vs "Nanos" versions for each method involving times.
The best way to express Conditions is to bind them to their host objects/locks upon construction. For uniformity though, we'd like to be able to attach conditions to either builtin locks or Lock objects, so should use factory methods for construction.
To avoid compatibility problems, the names of the methods need to be different than Object versions. The downside of this is that people can make the mistake of calling cond.notify instead of cond.signal. However, they will get IllegalMonitorState exceptions if they do, so they can detect the error if they ever run the code.
The implementation requires VM magic to atomically suspend and release lock. But it is unlikely to be very challenging for JVM providers, since most layer Java monitors on top of posix condvars or similar low-level functionality anyway.
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/Condition.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/TimeoutException.html
In my u.c package, I abstracted locks into "Sync", which was a bad choice of name. Even though some implementations may not act as classic mutex locks, they are all locks of some kind. The main interface mistake to fix in u.c version is to separately support a pure nonblocking (and thus non-IE-throwing) "attempt" rather than lumping it into timed versions.
Implementations include Mutex Semaphore ReentrantMutex FIFOSemaphore, etc. Some implementations may throw IllegalStateExceptions in some cases for some methods.
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/Lock.html
The best interface for ReadWrite locks is return a pair of locks:
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/ReadWriteLock.html
And to support the standard implementations (writer-preference etc).
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/Locks.html
Even though this requires adding new capabilities to builtin locks inside JVMs, the implementations should be straightforward, so JVM builders ought not complain. Most (all?) underlying locking strategies involve some kind of nonblocking trylock anyway. The timeout version would be heavier and slightly tricky if implemented purely via posix, but not too hard.
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/SynchronizationAttributes.html
Some care is needd in naming so that it will be possible (although not common) for people to create classes that implement both Queue and java.util.List, for implementations that can manipulate elements in the middle of the queue, not just the ends. Note however that these interfaces are intrinsically concurrent (thus thread-safe) since put() and take() block.
Since the target release is JDK1.5, and generics are slated to be in 1.5, Queue should be parametrized on element type. (Also some others below.) I'll ignore this for now.
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/Queue.html
Implementations include: LinkedQueue, BoundedArrayQueue (aka BoundedBuffer), HandOff (aka synchronous channel, CSP/Ada channel), PriorityQueue (also, BoundedPriorityQueue?), BoundedLinkedQueue.
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/CyclicBarrier.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/Exchanger.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/BrokenBarrierException.html
Executors are also the right place to standardize ways of calling threads that compute functions that return results via Futures. There are lots of Futures fans out there, it is simple to implement them once you have an Executor framework (all the mechanics can be done in an AbstractExecutor class), and it is worth standardizing conventions to avoid incompatibilities. I should have done it this way in u.c. Also, it is worth introducing a simple abstract Runnable implementation that contains a "done" bit so people don't keep reinventing this as well.
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/Executor.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/Callable.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/Future.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/AbstractExecutor.html
http://gee.cs.oswego.edu/dl/concurrent/java/util/concurrent/RunnableWithCompletionStatus.html
Implementations include: