code: private boolean writeLockAvailable(int type) {
          if (mReadLocks == 0 && mWriteLockHeld == null) {
              return (type == UPGRADABLE) ? true : mUpgradableLockHeld == null;
          }
          return false;
      }
docs: Caller must be synchronized.