Polish
This commit is contained in:
@@ -187,25 +187,25 @@ public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry {
|
||||
synchronized (this.updateCache) {
|
||||
Set<String> destinationsToRemove = new HashSet<String>();
|
||||
for (Map.Entry<String, MultiValueMap<String, String>> entry : this.updateCache.entrySet()) {
|
||||
String cachedDestination = entry.getKey();
|
||||
MultiValueMap<String, String> subs = entry.getValue();
|
||||
List<String> subsIds = subs.get(sessionId);
|
||||
if(subsIds != null) {
|
||||
subsIds.remove(subsId);
|
||||
if (subsIds.isEmpty()) {
|
||||
subs.remove(sessionId);
|
||||
String destination = entry.getKey();
|
||||
MultiValueMap<String, String> sessionMap = entry.getValue();
|
||||
List<String> subscriptions = sessionMap.get(sessionId);
|
||||
if (subscriptions != null) {
|
||||
subscriptions.remove(subsId);
|
||||
if (subscriptions.isEmpty()) {
|
||||
sessionMap.remove(sessionId);
|
||||
}
|
||||
if (subs.isEmpty()) {
|
||||
destinationsToRemove.add(cachedDestination);
|
||||
if (sessionMap.isEmpty()) {
|
||||
destinationsToRemove.add(destination);
|
||||
}
|
||||
else {
|
||||
this.accessCache.put(cachedDestination, new LinkedMultiValueMap<String, String>(subs));
|
||||
this.accessCache.put(destination, new LinkedMultiValueMap<String, String>(sessionMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String destinationToRemove : destinationsToRemove) {
|
||||
this.updateCache.remove(destinationToRemove);
|
||||
this.accessCache.remove(destinationToRemove);
|
||||
for (String destination : destinationsToRemove) {
|
||||
this.updateCache.remove(destination);
|
||||
this.accessCache.remove(destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,20 +214,20 @@ public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry {
|
||||
synchronized (this.updateCache) {
|
||||
Set<String> destinationsToRemove = new HashSet<String>();
|
||||
for (Map.Entry<String, MultiValueMap<String, String>> entry : this.updateCache.entrySet()) {
|
||||
String cachedDestination = entry.getKey();
|
||||
MultiValueMap<String, String> subs = entry.getValue();
|
||||
if(subs.remove(info.getSessionId()) != null) {
|
||||
if (subs.isEmpty()) {
|
||||
destinationsToRemove.add(cachedDestination);
|
||||
String destination = entry.getKey();
|
||||
MultiValueMap<String, String> sessionMap = entry.getValue();
|
||||
if (sessionMap.remove(info.getSessionId()) != null) {
|
||||
if (sessionMap.isEmpty()) {
|
||||
destinationsToRemove.add(destination);
|
||||
}
|
||||
else {
|
||||
this.accessCache.put(cachedDestination,new LinkedMultiValueMap<String, String>(subs));
|
||||
this.accessCache.put(destination, new LinkedMultiValueMap<String, String>(sessionMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String d : destinationsToRemove) {
|
||||
this.updateCache.remove(d);
|
||||
this.accessCache.remove(d);
|
||||
for (String destination : destinationsToRemove) {
|
||||
this.updateCache.remove(destination);
|
||||
this.accessCache.remove(destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user