code: public Optional<LockResource> tryGet(K key, LockMode mode) {
      ValNode valNode = getValNode(key);
      ReentrantReadWriteLock lock = valNode.mValue;
      Lock innerLock;
      switch (mode) {
        case READ:
          innerLock = lock.readLock();
          break;
        case WRITE:
          innerLock = lock.writeLock();
          break;
        default:
          throw new IllegalStateException("Unknown lock mode: " + mode);
      }
      if (!innerLock.tryLock()) {
        return Optional.empty();
      }
      return Optional.of(new RefCountLockResource(innerLock, false, valNode.mRefCount));
    }
docs: Attempts to take a lock on the given key.
  
  @param key the key to lock
  @param mode lockMode to acquire
  @return either empty or a lock resource which must be closed to unlock the key