public <T> void tryLock(final CheckedConsumer<T> consumer) {
        if (tryLock()) {
            try {
                consumer.accept(null);
            } catch (final Throwable e) {
                LoggingUtils.error(LOGGER, e);
                throw new RuntimeException(e);
            } finally {
                unlock();
            }
        }
    }
Acquires the lock if it is not held by another thread within the given
waiting time and the current thread has not been
{@linkplain Thread#interrupt interrupted}. Then, execute the given consumer.

@param <T>      the type parameter
@param consumer the consumer
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/concurrent/CasReentrantLock.java