public void updateAfterRemovedSubscription(String sessionId, String subsId) {
      for (Iterator<Map.Entry<String, LinkedMultiValueMap<String, String>>> iterator =
           this.accessCache.entrySet().iterator(); iterator.hasNext(); ) {
        Map.Entry<String, LinkedMultiValueMap<String, String>> entry = iterator.next();
        String destination = entry.getKey();
        this.accessCache.compute(destination, (key, value) -> {
          if (value != null) {
            List<String> subscriptions = value.get(sessionId);
            if (subscriptions != null) {
              subscriptions.remove(subsId);
              if (subscriptions.isEmpty()) {
                value.remove(sessionId);
              }
              if (value.isEmpty()) {
                return null;
              } else {
                this.notSubscriptionCache.invalidate(destination);
              }
            }
          }
          return value;
        });
      }
    }
Map from destination -> <sessionId, subscriptionId> for fast look-ups
ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/AmbariSubscriptionRegistry.java