Monday, November 10, 2008

Who's the Boss?

JBoss Cache 3.0.0 is almost ready, and its big feature, multi-version concurrency control (MVCC), is a big improvement. I assume that anyone who has tried to do anything interesting with JBoss Cache has run into this limitation: any time you try and upgrade a read lock to a write lock while another thread is holding a read lock on the same node, you get an UpgradeException. Preventing this situation from arising in an application is very complicated. You can use Java synchronization to prevent concurrent access to the same data, but then you're throwing away JBoss Cache's fine-grained locking system. The solution that I settled on was a fine-grained (but not hierarchical) java.util.concurrent.locks.Lock-based layer that prevented concurrent access to the same cache nodes. JBoss Cache 3.0.0 makes all of this code unnecessary. In a pinch me, I'm dreaming moment, I wrote this test (adapted from the TxDeadlockUnitTestCase) that causes the JBCACHE-97 bug and ran it against a 3.0.0 CR3 and 2.1.1 GA just to make sure the problem is really gone.

1 comment:

Dan Hodge said...

JBoss Cache 3.0.0 GA is now ready - http://jbosscache.blogspot.com/2008/11/jboss-cache-300-goes-ga.html