@SuppressWarnings( "LockAcquiredButNotSafelyReleased" )
    public AutoCloseableLock lock() throws IllegalStateException {
        checkNotReleased();
        lock.lock();
        return autoCloseable;
    }
@Test(timeout = 1000)
    public void willUseDifferentLocksForDifferentClassesWithTheSamePart() {

        final AtomicBoolean lockAcquired = new AtomicBoolean(false);
        final AtomicInteger callCount = new AtomicInteger(0);

        thread1 = new Thread(() -> {
            try (final AutoCloseableReentrantLock.AutoCloseableLock ignored = new AutoCloseableReentrantLock(AutoCloseableReentrantLockTest.class, "user1").lock()) {
                lockAcquired.set(true);
                callCount.incrementAndGet();
                Thread.sleep(1000);
            } catch (final InterruptedException e) {
                LOGGER.info("Interrupted whilst sleeping", e);
            }
        });
        thread1.start();

        // Create a lock for the same user but for a different class - should be acquired
        thread2 = new Thread(() -> {
            try (final AutoCloseableReentrantLock.AutoCloseableLock ignored = new AutoCloseableReentrantLock(XMPPServer.class, "user1").lock()) {
                lockAcquired.set(true);
                callCount.incrementAndGet();
                Thread.sleep(1000);
            } catch (final InterruptedException e) {
                LOGGER.info("Interrupted whilst sleeping", e);
            }
        });
        thread2.start();

        // Wait until we can be sure both threads have started
        await().untilTrue(lockAcquired);

        assertThat(callCount.get(), is(2));

    }