April 2004 Archives

Concurrent channel copying algorithm

I've been studying the new java.util.concurrent package. And, as part of this, I've been reading Doug Lea's book Concurrent Programming in Java: Design Principles and Patterns.

The book is well written and enlightening, and the package is powerful and has some very cool utilities in it.

Inspired by an example Doug gives in both the book and the javadoc, I've written a concurrent version of the basic New I/O byte channel copying loop. This is the loop you write anytime you need to copy bytes from one channel to another. A proxy server would use this, for example, to copy bytes from one socket to another. Here it is in the traditional single-threaded form:

Generics in java.util.concurrent

I've been reading up on the new concurrency utilities in java.util.concurrent. Overall, I'm very impressed. But what I think is particularly interesting is how well generic types fit with the "Executors" framework of these utilities. Here's a brief rundown:

Books

Comprehensive coverage of Ruby 1.8 and 1.9

"The New Most Important Ruby Book"
Peter Cooper,
rubyinside.com

Completely updated for Ajax and Web 2.0

"A must-have reference"
Brendan Eich,
creator of JavaScript

The classic Java quick-reference