DefaultSubscriptionRegistry's removeSubscriptionInternal defensively handles non-existing destinations
Issue: SPR-11832
This commit is contained in:
@@ -48,12 +48,12 @@ public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry {
|
|||||||
/** The maximum number of entries in the cache */
|
/** The maximum number of entries in the cache */
|
||||||
private volatile int cacheLimit = DEFAULT_CACHE_LIMIT;
|
private volatile int cacheLimit = DEFAULT_CACHE_LIMIT;
|
||||||
|
|
||||||
|
private PathMatcher pathMatcher = new AntPathMatcher();
|
||||||
|
|
||||||
private final DestinationCache destinationCache = new DestinationCache();
|
private final DestinationCache destinationCache = new DestinationCache();
|
||||||
|
|
||||||
private final SessionSubscriptionRegistry subscriptionRegistry = new SessionSubscriptionRegistry();
|
private final SessionSubscriptionRegistry subscriptionRegistry = new SessionSubscriptionRegistry();
|
||||||
|
|
||||||
private PathMatcher pathMatcher = new AntPathMatcher();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the maximum number of entries for the resolved destination cache.
|
* Specify the maximum number of entries for the resolved destination cache.
|
||||||
@@ -71,19 +71,20 @@ public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PathMatcher to use.
|
* Specify the {@link PathMatcher} to use.
|
||||||
*/
|
*/
|
||||||
public void setPathMatcher(PathMatcher pathMatcher) {
|
public void setPathMatcher(PathMatcher pathMatcher) {
|
||||||
this.pathMatcher = pathMatcher;
|
this.pathMatcher = pathMatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configured PathMatcher.
|
* Return the configured {@link PathMatcher}.
|
||||||
*/
|
*/
|
||||||
public PathMatcher getPathMatcher() {
|
public PathMatcher getPathMatcher() {
|
||||||
return this.pathMatcher;
|
return this.pathMatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addSubscriptionInternal(String sessionId, String subsId, String destination, Message<?> message) {
|
protected void addSubscriptionInternal(String sessionId, String subsId, String destination, Message<?> message) {
|
||||||
this.subscriptionRegistry.addSubscription(sessionId, subsId, destination);
|
this.subscriptionRegistry.addSubscription(sessionId, subsId, destination);
|
||||||
@@ -95,7 +96,7 @@ public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry {
|
|||||||
SessionSubscriptionInfo info = this.subscriptionRegistry.getSubscriptions(sessionId);
|
SessionSubscriptionInfo info = this.subscriptionRegistry.getSubscriptions(sessionId);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
String destination = info.removeSubscription(subsId);
|
String destination = info.removeSubscription(subsId);
|
||||||
if (info.getSubscriptions(destination) == null) {
|
if (destination != null && info.getSubscriptions(destination) == null) {
|
||||||
this.destinationCache.updateAfterRemovedSubscription(destination, sessionId, subsId);
|
this.destinationCache.updateAfterRemovedSubscription(destination, sessionId, subsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,9 +207,9 @@ public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String d : destinationsToRemove) {
|
for (String destinationToRemove : destinationsToRemove) {
|
||||||
this.updateCache.remove(d);
|
this.updateCache.remove(destinationToRemove);
|
||||||
this.accessCache.remove(d);
|
this.accessCache.remove(destinationToRemove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user