private synchronized void checkNotReleased() throws IllegalStateException {
        if (key == null) {
            throw new IllegalStateException("Lock has already been released");
        }
    }
Create a class and resource specific lock. If another thread has not closed another AutoCloseableReentrantLock
with the same class and resource then this will block until it is closed.

@param clazz    The class for which the lock should be created.
@param resource The resource for which the lock should be created.
xmppserver/src/main/java/org/jivesoftware/util/AutoCloseableReentrantLock.java