The Great JCache Pull request :)

Another tip:

if you hold a lock, hold it as short as possible. All that verification you do on the cache, can also be done after the synchronized block. This reduces contention and also reduces the chances of more complicated problems like deadlock.