public Optional<AutoCloseableLock> tryLock() {
        checkNotReleased();
        if (lock.tryLock()) {
            return Optional.of(autoCloseable);
        } else {
            return Optional.empty();
        }
    }
Tries to acquire the lock, returning immediately.

@return An AutoCloseableLock if the lock was required, otherwise empty.
@throws IllegalStateException if this lock has already been released by the last thread to hold it
xmppserver/src/main/java/org/jivesoftware/util/AutoCloseableReentrantLock.java