/** * {@inheritDoc} */ @Override public boolean clearSnapshot(T group) { writeLock.lock(); try { CacheStatusInfo<T> status = statuses.get(group); // If we don't know about this group, do nothing. if (status != null && status.numWatches() > 0) { LOGGER.warn("tried to clear snapshot for group with existing watches, group={}", group); return false; } statuses.remove(group); snapshots.remove(group); return true; } finally { writeLock.unlock(); } }
CacheStatusInfo<T> status = statuses.computeIfAbsent(group, g -> new CacheStatusInfo<>(group)); status.setLastWatchRequestTime(System.currentTimeMillis()); request.getVersionInfo()); status.setWatch(watchId, watch); watch.setStop(() -> status.removeWatch(watchId));
status.watchesRemoveIf((id, watch) -> { String version = snapshot.version(watch.request().getTypeUrl());