@Test public void onlyAlreadyWatchedRangesAreIgnoredOnRegistration() { LockWatchRequest request = tableRequest(); lockWatcher.startWatching(request); LockWatchReference newWatch = LockWatchReferenceUtils.entireTable(TABLE_2); LockWatchRequest prefixAndOtherTableRequest = LockWatchRequest.of(ImmutableSet.of( LockWatchReferenceUtils.rowPrefix(TABLE, ROW), newWatch)); lockWatcher.startWatching(prefixAndOtherTableRequest); List<LockWatchEvent> expectedEvents = ImmutableList.of( createdEvent(request.getReferences(), ImmutableSet.of(ROW_DESCRIPTOR)), createdEvent(ImmutableSet.of(newWatch), ImmutableSet.of(descriptorForOtherTable()))); 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);  }