Skip to content

Commit

Permalink
解决trafficRouter重复监听的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
panxiaojun233 committed Feb 6, 2023
1 parent ae09653 commit a265fad
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ public static TrafficRoutingRuleGroup getTrafficRoutingRules() {
}

public static synchronized void register(String app) {
trafficRouterRuleListenerMap.put(app, object);

for (RemoteAppObserver subscriber : subscribers) {
subscriber.onRemoteAppAppears(app);
Object value = trafficRouterRuleListenerMap.put(app, object);
if (value == null) {
for (RemoteAppObserver subscriber : subscribers) {
subscriber.onRemoteAppAppears(app);
}
}
}

public static synchronized void unregister(String app) {
trafficRouterRuleListenerMap.remove(app);
// todo unsubscribe
for (RemoteAppObserver subscriber : subscribers) {
subscriber.onRemoteAppDisappears(app);
}
trafficRouterRuleListenerMap.remove(app);
}
}

0 comments on commit a265fad

Please sign in to comment.