Source:
private void runOneIteration() { try { LockWatchTestRuntimeConfig config = runtime.get(); if (config.namespaceToWatch().isPresent()) { LockWatchingResource lockWatcher = resource.apply(config.namespaceToWatch().get()); LockWatchRequest request = LockWatchRequest.of(config.tablesToWatch().stream() .map(TableReference::getQualifiedName) .map(LockWatchReferences::entireTable) .collect(Collectors.toSet())); LockWatchStateUpdate versionBefore = lockWatcher.getWatchState( OptionalLong.empty()); long startRegistering = System.currentTimeMillis(); lockWatcher.startWatching(request); log.info("Registered lock watches for keyspace and tables in seconds.", SafeArg.of("keyspace", config.namespaceToWatch().get()), SafeArg.of("tables", config.tablesToWatch()), SafeArg.of("seconds", System.currentTimeMillis() - startRegistering)); long startUpdate = System.currentTimeMillis(); LockWatchStateUpdate versionAfter = lockWatcher.getWatchState(versionBefore.lastKnownVersion()); long duration = System.currentTimeMillis() - startUpdate; if (versionAfter.success()) { Optional<LockWatchEvent> result = versionAfter.events().stream() .map(event -> event.accept(filter)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); if (!result.isPresent()) { log.info("Registered lock watches, but did not find any open locks. Took seconds", SafeArg.of("duration", duration)); } else { log.info("Registered lock watches, found open locks. Took seconds.", SafeArg.of("numberOfWatches", ((LockWatchOpenLocksEvent) result.get()).lockDescriptors().size()), SafeArg.of("duration", duration)); } } else { log.info("Registered lock watches, but was unable to get an update. Last known version is {}", SafeArg.of("lastKnownVersion", versionAfter.lastKnownVersion())); } } } catch (Throwable th) { log.info("Failed to run a test iteration of registering lock watches", th); } }

Target:
private void runOneIteration() { try { LockWatchTestRuntimeConfig config = runtime.get(); if (config.namespaceToWatch().isPresent()) { LockWatchingResource lockWatcher = resource.apply(config.namespaceToWatch().get()); LockWatchRequest request = LockWatchRequest.of(config.tablesToWatch().stream() .map(TableReference::getQualifiedName) .map(LockWatchReferences::entireTable) .collect(Collectors.toSet())); LockWatchStateUpdate versionBefore = lockWatcher.getWatchState( OptionalLong.empty()); long startRegistering = System.currentTimeMillis(); lockWatcher.startWatching(request); log.info("Registered lock watches for keyspace and tables in milliseconds.", SafeArg.of("keyspace", config.namespaceToWatch().get()), SafeArg.of("tables", config.tablesToWatch()), SafeArg.of("seconds", System.currentTimeMillis() - startRegistering)); long startUpdate = System.currentTimeMillis(); LockWatchStateUpdate versionAfter = lockWatcher.getWatchState(versionBefore.lastKnownVersion()); long duration = System.currentTimeMillis() - startUpdate; if (versionAfter.success()) { List<Integer> result = versionAfter.events().stream() .map(event -> event.accept(filter)) .filter(Optional::isPresent) .map(Optional::get) .map(LockWatchOpenLocksEvent::lockDescriptors) .map(Set::size) .collect(Collectors.toList()); if (result.isEmpty()) { log.info("Registered lock watches, but did not find any open locks. Took milliseconds", SafeArg.of("duration", duration)); } else { log.info("Registered lock watches, found open locks entries in the log. They contained {}" + " locks respectively. This registration event took milliseconds.", SafeArg.of("numberOfEvents", result.size()), SafeArg.of("numberOfWatches", result), SafeArg.of("duration", duration)); } } else { log.info("Registered lock watches, but was unable to get an update. Last known version is {}", SafeArg.of("lastKnownVersion", versionAfter.lastKnownVersion())); } } } catch (Throwable th) { log.info("Failed to run a test iteration of registering lock watches", th); } }