@Test public void should_create_the_lock_once() throws SQLException { lock.acquire(connection); Connection connection2 = mock(Connection.class, RETURNS_DEEP_STUBS); lock.acquire(connection2); verify(createStatement).execute(); verify(connection, times(3)).commit(); verifyNoInteractions(connection2); }
void acquire(Connection connection) { if (addConnection(connection)) { LOGGER.debug("Acquiring lock {} on database", uuid); addShutdownHook(); ensureLockUniqueness(connection); tryWriteLock(connection); } }
LiquigraphLock { void acquire(Connection connection) { if (addConnection(connection)) { LOGGER.debug("Acquiring lock {} on database", uuid); addShutdownHook(); ensureLockUniqueness(connection); tryWriteLock(connection); } } }
LiquigraphLock { void acquire(Connection connection) { if (addConnection(connection)) { LOGGER.debug("Acquiring lock {} on database", uuid); addShutdownHook(); ensureLockUniqueness(connection); tryWriteLock(connection); } } LiquigraphLock(Supplier<Connection> connection); }
LiquigraphLock { void acquire(Connection connection) { if (addConnection(connection)) { LOGGER.debug("Acquiring lock {} on database", uuid); addShutdownHook(); ensureLockUniqueness(connection); tryWriteLock(connection); } } LiquigraphLock(Supplier<Connection> connection);  }
LiquigraphLock { void acquire(Connection connection) { if (addConnection(connection)) { LOGGER.debug("Acquiring lock {} on database", uuid); addShutdownHook(); ensureLockUniqueness(connection); tryWriteLock(connection); } } LiquigraphLock(Supplier<Connection> connection);   }