@Test public void test_good_unlock() { Lock good = LockTestUtils.goodLock(null); Lock good2 = LockTestUtils.goodLock(null); MultiLock multiLock = new MultiLock(null, good, good2); multiLock.unlock(); verify(good, times(1)).unlock(); verify(good2, times(1)).unlock(); }
@Override public void unlock() { for (Lock lock : locks) { try { lock.unlock(); } catch (Throwable t) { log.error("Failed to unlock [{}], unlock() should never throw an exception", lock.getLockDefinition().getLockId(), t); } } }
MultiLock implements Lock { @Override public void unlock() { for (Lock lock : locks) { try { lock.unlock(); } catch (Throwable t) { log.error("Failed to unlock [{}], unlock() should never throw an exception", lock.getLockDefinition().getLockId(), t); } } } }
MultiLock implements Lock { @Override public void unlock() { for (Lock lock : locks) { try { lock.unlock(); } catch (Throwable t) { log.error("Failed to unlock [{}], unlock() should never throw an exception", lock.getLockDefinition().getLockId(), t); } } } MultiLock(MultiLockDefinition def, Lock... locks);  MultiLock(MultiLockDefinition def, LockProvider provider); }
MultiLock implements Lock { @Override public void unlock() { for (Lock lock : locks) { try { lock.unlock(); } catch (Throwable t) { log.error("Failed to unlock [{}], unlock() should never throw an exception", lock.getLockDefinition().getLockId(), t); } } } MultiLock(MultiLockDefinition def, Lock... locks);  MultiLock(MultiLockDefinition def, LockProvider provider); Lock[] getLocks(); @Override boolean tryLock(); @Override void lock(); @Override void unlock(); @Override LockDefinition getLockDefinition(); }
MultiLock implements Lock { @Override public void unlock() { for (Lock lock : locks) { try { lock.unlock(); } catch (Throwable t) { log.error("Failed to unlock [{}], unlock() should never throw an exception", lock.getLockDefinition().getLockId(), t); } } } MultiLock(MultiLockDefinition def, Lock... locks);  MultiLock(MultiLockDefinition def, LockProvider provider); Lock[] getLocks(); @Override boolean tryLock(); @Override void lock(); @Override void unlock(); @Override LockDefinition getLockDefinition();  }