Tuesday, June 06, 2006
Java Concurrency Annotations
I'm in the process of reading Java Concurrency in Practice by Brian Goetz et al. So far this is a terrific book. It is extraordinarily well written and very informative. I'm intrigued by a set of annotations in the book (@ThreadSafe, @NotThreadSafe, @Immutable, and @GuardedBy). The book suggests these annotations are ideal for use by static analysis tools. I think this is a phenomenal idea and a highly effective use of annotations. I started looking to see if any of the tools I use have rules to utilize these annotations. I did find reference to the JCIP annotations on the FindBugs site, but nothing from PMD or CheckStyle yet. Anyhow downloads, documentation, and source of the JCIP annoations can be found here. Check them out if you need a way to document the intent of thread safety in your classes as well as be warned if the classes are modified in such a way that your original concurrency design is broken by maintenance.