Decreasing count when removing subscription listener
This commit is contained in:
parent
5e88c209e3
commit
6ac84f9a52
1 changed files with 8 additions and 6 deletions
|
@ -111,13 +111,15 @@ public class SubscriptionResponse {
|
||||||
* to be removed from the list.
|
* to be removed from the list.
|
||||||
*/
|
*/
|
||||||
public void removeSubscriptionListener(SubscriptionListener subscriptionListener){
|
public void removeSubscriptionListener(SubscriptionListener subscriptionListener){
|
||||||
int currentCount = listenerTypeCount.get(subscriptionListener.getInterestObjectType());
|
if(listenerTypeCount.containsKey(subscriptionListener.getInterestObjectType())){
|
||||||
if(currentCount != 0){
|
int currentCount = listenerTypeCount.get(subscriptionListener.getInterestObjectType());
|
||||||
this.listenerTypeCount.put(subscriptionListener.getInterestObjectType(), currentCount);
|
if(currentCount > 0){
|
||||||
}else{
|
this.listenerTypeCount.put(subscriptionListener.getInterestObjectType(), currentCount - 1);
|
||||||
System.out.println("Trying to remove subscription listener, but none is registered!");
|
this.mListeners.remove(subscriptionListener);
|
||||||
|
}else{
|
||||||
|
System.out.println("Trying to remove subscription listener, but none is registered!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.mListeners.remove(subscriptionListener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue