core/src/main/java/com/orientechnologies/common/concur/lock/ScalableRWLock.java
public boolean sharedTryLock() {
    ReadersEntry localEntry = entry.get();
    // Initialize a new Reader-state for this thread if needed
    if (localEntry == null) {
      localEntry = addState();
    }

    final AtomicInteger currentReadersState = localEntry.state;
    currentReadersState.set(SRWL_STATE_READING);
    if (!stampedLock.isWriteLocked()) {
      // Acquired lock in read-only mode
      return true;
    } else {
      // Go back to SRWL_STATE_NOT_READING and quit
      currentReadersState.set(SRWL_STATE_NOT_READING);
      return false;
    }
  }
public boolean sharedTryLock() {
    ReadersEntry localEntry = entry.get();
    // Initialize a new Reader-state for this thread if needed
    if (localEntry == null) {
      localEntry = addState();
    }

    final AtomicInteger currentReadersState = localEntry.state;
    currentReadersState.set(SRWL_STATE_READING);
    if (!stampedLock.isWriteLocked()) {
      // Acquired lock in read-only mode
      return true;
    } else {
      // Go back to SRWL_STATE_NOT_READING and quit
      currentReadersState.set(SRWL_STATE_NOT_READING);
      return false;
    }
  }
Acquires the read lock only if the write lock is not held by
another thread at the time of invocation.
<p>Acquires the read lock if the write lock is not held by
another thread and returns immediately with the value
{@code true}.
<p>If the write lock is held by another thread then
this method will return immediately with the value
{@code false}.

@return {@code true} if the read lock was acquired