private void respond(Watch watch, Snapshot snapshot, T group) { Map<String, ? extends Message> snapshotResources = snapshot.resources(watch.request().getTypeUrl()); if (!watch.request().getResourceNamesList().isEmpty() && watch.ads()) { Collection<String> missingNames = watch.request().getResourceNamesList().stream() .filter(name -> !snapshotResources.containsKey(name)) .collect(Collectors.toList()); LOGGER.info( "not responding in ADS mode for {} from node {} at version {} for request [{}] since [{}] not in snapshot", watch.request().getTypeUrl(), group, snapshot.version(watch.request().getTypeUrl()), String.join(", ", watch.request().getResourceNamesList()), String.join(", ", missingNames)); String version = snapshot.version(watch.request().getTypeUrl()); watch.request().getTypeUrl(), group, watch.request().getVersionInfo(), version); watch.request(), snapshotResources, version); watch.respond(response); } catch (WatchCancelledException e) { LOGGER.error(
/** * Sends the given response to the watch's response handler. * * @param response the response to be handled * @throws WatchCancelledException if the watch has already been cancelled */ public void respond(Response response) throws WatchCancelledException { if (isCancelled()) { throw new WatchCancelledException(); } responseConsumer.accept(response); }
oldWatch.cancel();