A Java tool to access Grand Central Dispatch (GCD) on Mac OS X

I just read this announcement on the Apple Java Mailing List about a new library/tool named GCDExecutorService.

As the announcement states, this is "an implementation of a Java ExecutorService that completes tasks (Runnables and Callables) by passing them to Grand Central Dispatch to be run." On his web page the author later writes, "GCDExecutorService is a Java ExecutorService (Executor) that runs tasks by passing them to Cocoa's NSOperationQueue."

If you're writing Java code specifically for the Mac -- and you don't mind having your code tied to the Mac OS X platform -- this looks pretty cool.

The author shares a snippet of sample code which shows how this works:

Runnable myWork = ...
ExecutorService gcd = new GCDExecutorService();
gcd.execute(myWork);

This sounds pretty cool, and I'm looking forward to seeing some performance test results to see how this compares to using native Java threads. (If you're wondering why Apple hasn't built this technology directly into their Java JVM yet, there's a good discussion on this on the Apple Java-dev mailing list (Java-dev@lists.apple.com.)

If you're not familiar with Mac OS X, it's important to know that this tool will only work on Mac OS X 10.6 and newer operating systems. At the time of this writing, Apple just released the Grand Central Dispatch technology in this "Snow Leopard" operating system.

For more information about this new Java Grand Central Dispatch (GCD) library/tool, check out the author's GCDExecutorService information page. Kudos to this developer for creating an interesting feature for Mac Java developers.