/** * Block until we can acquire a non-exclusive mutator lock on the servers 's persistent state. * This lock should be acquired in a <code>try</code> block and a <code>releaseMutatorLock</code> * call should be placed in a <code>finally</code> block. */ public void acquireMutatorLock() { // Do we already hold a lock? Long lockStateVal = lockState.get(); if (lockStateVal == null) lockStateVal = zero; final long longVal = lockStateVal; if (longVal == 0) { // No, this thread currently does not hold a lock, // grab non-exclusive lock (which for mutatorLock is a // read lock) mutatorLock.readLock(); } // Ether way, bump the lock count and update our thread state lockState.set(longVal + 1); }