public void updateAfterRemovedSession(SessionSubscriptionInfo info) { synchronized (this.updateCache) { Set<String> destinationsToRemove = new HashSet<>(); this.updateCache.forEach((destination, sessionMap) -> { if (sessionMap.remove(info.getSessionId()) != null) { if (sessionMap.isEmpty()) { destinationsToRemove.add(destination); } else { this.accessCache.put(destination, sessionMap.deepCopy()); } } }); for (String destination : destinationsToRemove) { this.updateCache.remove(destination); this.accessCache.remove(destination); } } }
public void updateAfterRemovedSubscription(String sessionId, String subsId) { synchronized (this.updateCache) { Set<String> destinationsToRemove = new HashSet<>(); this.updateCache.forEach((destination, sessionMap) -> { List<String> subscriptions = sessionMap.get(sessionId); if (subscriptions != null) { subscriptions.remove(subsId); if (subscriptions.isEmpty()) { sessionMap.remove(sessionId); } if (sessionMap.isEmpty()) { destinationsToRemove.add(destination); } else { this.accessCache.put(destination, sessionMap.deepCopy()); } } }); for (String destination : destinationsToRemove) { this.updateCache.remove(destination); this.accessCache.remove(destination); } } }
public void heartbeat() { LinkedMultiValueMap<String, ElasticAgentMetadata> elasticAgentsOfMissingPlugins = agentService.allElasticAgents(); // pingMessage TTL is set lesser than elasticPluginHeartBeatInterval to ensure there aren't multiple ping request for the same plugin long pingMessageTimeToLive = elasticPluginHeartBeatInterval - 10000L; for (PluginDescriptor descriptor : elasticAgentPluginRegistry.getPlugins()) { serverPingQueue.post(new ServerPingMessage(descriptor.id()), pingMessageTimeToLive); elasticAgentsOfMissingPlugins.remove(descriptor.id()); serverHealthService.removeByScope(scope(descriptor.id())); } if (!elasticAgentsOfMissingPlugins.isEmpty()) { for (String pluginId : elasticAgentsOfMissingPlugins.keySet()) { Collection<String> uuids = elasticAgentsOfMissingPlugins.get(pluginId).stream().map(ElasticAgentMetadata::uuid).collect(Collectors.toList()); String description = String.format("Elastic agent plugin with identifier %s has gone missing, but left behind %s agent(s) with UUIDs %s.", pluginId, elasticAgentsOfMissingPlugins.get(pluginId).size(), uuids); serverHealthService.update(ServerHealthState.warning("Elastic agents with no matching plugins", description, HealthStateType.general(scope(pluginId)))); LOGGER.warn(description); } } }
public void updateAfterRemovedSession(SessionSubscriptionInfo info) { synchronized (this.updateCache) { Set<String> destinationsToRemove = new HashSet<>(); this.updateCache.forEach((destination, sessionMap) -> { if (sessionMap.remove(info.getSessionId()) != null) { if (sessionMap.isEmpty()) { destinationsToRemove.add(destination); } else { this.accessCache.put(destination, sessionMap.deepCopy()); } } }); for (String destination : destinationsToRemove) { this.updateCache.remove(destination); this.accessCache.remove(destination); } } }
public void updateAfterRemovedSubscription(String sessionId, String subsId) { synchronized (this.updateCache) { Set<String> destinationsToRemove = new HashSet<>(); this.updateCache.forEach((destination, sessionMap) -> { List<String> subscriptions = sessionMap.get(sessionId); if (subscriptions != null) { subscriptions.remove(subsId); if (subscriptions.isEmpty()) { sessionMap.remove(sessionId); } if (sessionMap.isEmpty()) { destinationsToRemove.add(destination); } else { this.accessCache.put(destination, sessionMap.deepCopy()); } } }); for (String destination : destinationsToRemove) { this.updateCache.remove(destination); this.accessCache.remove(destination); } } }
/** * @param p_NameMap * @param p_Method */ private void removeNamelMap(LinkedMultiValueMap<String, HandlerMethod> p_NameMap, HandlerMethod p_Method) { ArrayList<String> list = new ArrayList<String>(); for (Map.Entry<String, List<HandlerMethod>> item : p_NameMap.entrySet()) { if (item.getValue().contains(p_Method)) { list.add(item.getKey()); } } if (list.size() > 0) { for (int i = 0; i < list.size(); i++) { List<HandlerMethod> methods = p_NameMap.get(list.get(i)); if (methods.size() > 1) { methods.remove(p_Method); } else { p_NameMap.remove(list.get(i)); } } } }
/** * removeUrlMap * * @param p_UrlMap * @param p_Info */ private void removeUrlMap(LinkedMultiValueMap<String, RequestMappingInfo> p_UrlMap, RequestMappingInfo p_Info) { ArrayList<String> list = new ArrayList<String>(); for (Map.Entry<String, List<RequestMappingInfo>> item : p_UrlMap.entrySet()) { if (item.getValue().contains(p_Info)) { list.add(item.getKey()); } } if (list.size() > 0) { for (int i = 0; i < list.size(); i++) { List<RequestMappingInfo> infos = p_UrlMap.get(list.get(i)); if (infos.size() > 1) { infos.remove(p_Info); } else { p_UrlMap.remove(list.get(i)); } } } }
public void updateAfterRemovedSession(SessionSubscriptionInfo info) { synchronized (this.updateCache) { Set<String> destinationsToRemove = new HashSet<>(); this.updateCache.forEach((destination, sessionMap) -> { if (sessionMap.remove(info.getSessionId()) != null) { if (sessionMap.isEmpty()) { destinationsToRemove.add(destination); } else { this.accessCache.put(destination, sessionMap.deepCopy()); } } }); for (String destination : destinationsToRemove) { this.updateCache.remove(destination); this.accessCache.remove(destination); } } }
public void updateAfterRemovedSession(SessionSubscriptionInfo info) { synchronized (this.updateCache) { Set<String> destinationsToRemove = new HashSet<>(); this.updateCache.forEach((destination, sessionMap) -> { if (sessionMap.remove(info.getSessionId()) != null) { if (sessionMap.isEmpty()) { destinationsToRemove.add(destination); } else { this.accessCache.put(destination, sessionMap.deepCopy()); } } }); for (String destination : destinationsToRemove) { this.updateCache.remove(destination); this.accessCache.remove(destination); } } }
public void updateAfterRemovedSubscription(String sessionId, String subsId) { synchronized (this.updateCache) { Set<String> destinationsToRemove = new HashSet<>(); this.updateCache.forEach((destination, sessionMap) -> { List<String> subscriptions = sessionMap.get(sessionId); if (subscriptions != null) { subscriptions.remove(subsId); if (subscriptions.isEmpty()) { sessionMap.remove(sessionId); } if (sessionMap.isEmpty()) { destinationsToRemove.add(destination); } else { this.accessCache.put(destination, sessionMap.deepCopy()); } } }); for (String destination : destinationsToRemove) { this.updateCache.remove(destination); this.accessCache.remove(destination); } } }
public void updateAfterRemovedSubscription(String sessionId, String subsId) { synchronized (this.updateCache) { Set<String> destinationsToRemove = new HashSet<>(); this.updateCache.forEach((destination, sessionMap) -> { List<String> subscriptions = sessionMap.get(sessionId); if (subscriptions != null) { subscriptions.remove(subsId); if (subscriptions.isEmpty()) { sessionMap.remove(sessionId); } if (sessionMap.isEmpty()) { destinationsToRemove.add(destination); } else { this.accessCache.put(destination, sessionMap.deepCopy()); } } }); for (String destination : destinationsToRemove) { this.updateCache.remove(destination); this.accessCache.remove(destination); } } }