@Test public void registeringWatchWithWiderScopeLogsAlreadyWatchedLocksAgain() { LockDescriptor secondRow = AtlasRowLockDescriptor.of(TABLE.getQualifiedName(), PtBytes.toBytes("other_row")); when(heldLocks.getLocks()).thenReturn(ImmutableList.of(LOCK, new ExclusiveLock(secondRow))); LockWatchRequest prefixRequest = prefixRequest(ROW); lockWatcher.startWatching(prefixRequest); LockWatchRequest entireTableRequest = tableRequest(); lockWatcher.startWatching(entireTableRequest); List<LockWatchEvent> expectedEvents = ImmutableList.of( createdEvent(prefixRequest.getReferences(), ImmutableSet.of(ROW_DESCRIPTOR)), createdEvent(entireTableRequest.getReferences(), ImmutableSet.of(ROW_DESCRIPTOR, secondRow))); assertLoggedEvents(expectedEvents); }
@Override public void startWatching(LockWatchRequest locksToWatch) { Optional<LockWatches> changes = addToWatches(locksToWatch); changes.ifPresent(this::logLockWatchEvent); }
LockWatchingServiceImpl implements LockWatchingService { @Override public void startWatching(LockWatchRequest locksToWatch) { Optional<LockWatches> changes = addToWatches(locksToWatch); changes.ifPresent(this::logLockWatchEvent); } }
LockWatchingServiceImpl implements LockWatchingService { @Override public void startWatching(LockWatchRequest locksToWatch) { Optional<LockWatches> changes = addToWatches(locksToWatch); changes.ifPresent(this::logLockWatchEvent); } LockWatchingServiceImpl(HeldLocksCollection heldLocksCollection); @VisibleForTesting  LockWatchingServiceImpl(UUID logId, HeldLocksCollection heldLocksCollection); }
LockWatchingServiceImpl implements LockWatchingService { @Override public void startWatching(LockWatchRequest locksToWatch) { Optional<LockWatches> changes = addToWatches(locksToWatch); changes.ifPresent(this::logLockWatchEvent); } LockWatchingServiceImpl(HeldLocksCollection heldLocksCollection); @VisibleForTesting  LockWatchingServiceImpl(UUID logId, HeldLocksCollection heldLocksCollection); @Override void startWatching(LockWatchRequest locksToWatch); @Override LockWatchStateUpdate getWatchStateUpdate(Optional<LockWatchVersion> lastKnownVersion); @Override ValueAndLockWatchStateUpdate<T> runTask(
            Optional<LockWatchVersion> lastKnownVersion, Supplier<T> task); @Override void registerLock(Set<LockDescriptor> locksTakenOut, LockToken token); @Override void registerUnlock(Set<LockDescriptor> unlocked); }
LockWatchingServiceImpl implements LockWatchingService { @Override public void startWatching(LockWatchRequest locksToWatch) { Optional<LockWatches> changes = addToWatches(locksToWatch); changes.ifPresent(this::logLockWatchEvent); } LockWatchingServiceImpl(HeldLocksCollection heldLocksCollection); @VisibleForTesting  LockWatchingServiceImpl(UUID logId, HeldLocksCollection heldLocksCollection); @Override void startWatching(LockWatchRequest locksToWatch); @Override LockWatchStateUpdate getWatchStateUpdate(Optional<LockWatchVersion> lastKnownVersion); @Override ValueAndLockWatchStateUpdate<T> runTask(
            Optional<LockWatchVersion> lastKnownVersion, Supplier<T> task); @Override void registerLock(Set<LockDescriptor> locksTakenOut, LockToken token); @Override void registerUnlock(Set<LockDescriptor> unlocked);  }