Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation
String methodName = RpcUtils.getMethodName(invocation);
String key = invokers.get(0).getUrl().getServiceKey() + "." + methodName;
int invokersHashCode = invokers.hashCode();
// If the detection is successful, return in advance. it may be different from selector, but it doesn't matter
ConsistentHashSelector<T> oldSelector0;
if ((oldSelector0 = (ConsistentHashSelector<T>) selectors.get(key)) != null
&& oldSelector0.identityHashCode == invokersHashCode) {
return oldSelector0.select(invocation);
}

// using the hashcode of invoker list to create consistent selector by atomic computation.
ConsistentHashSelector<T> selector = (ConsistentHashSelector<T>) selectors.compute(
key,
Expand Down
Loading