Skip to content

Commit

Permalink
Remove unnecessary braces.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralf0131 committed Dec 10, 2018
1 parent ffba834 commit 59621f5
Showing 1 changed file with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,18 @@ protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List
String methodName = invocation == null ? "" : invocation.getMethodName();

boolean sticky = invokers.get(0).getUrl().getMethodParameter(methodName, Constants.CLUSTER_STICKY_KEY, Constants.DEFAULT_CLUSTER_STICKY);
{
//ignore overloaded method
if (stickyInvoker != null && !invokers.contains(stickyInvoker)) {
stickyInvoker = null;
}
//ignore concurrency problem
if (sticky && stickyInvoker != null && (selected == null || !selected.contains(stickyInvoker))) {
if (availablecheck && stickyInvoker.isAvailable()) {
return stickyInvoker;
}

//ignore overloaded method
if (stickyInvoker != null && !invokers.contains(stickyInvoker)) {
stickyInvoker = null;
}
//ignore concurrency problem
if (sticky && stickyInvoker != null && (selected == null || !selected.contains(stickyInvoker))) {
if (availablecheck && stickyInvoker.isAvailable()) {
return stickyInvoker;
}
}

Invoker<T> invoker = doSelect(loadbalance, invocation, invokers, selected);

if (sticky) {
Expand Down Expand Up @@ -209,20 +209,20 @@ private Invoker<T> reselect(LoadBalance loadbalance, Invocation invocation,
return loadbalance.select(reselectInvokers, getUrl(), invocation);
}
}

// Just pick an available invoker using loadbalance policy
{
if (selected != null) {
for (Invoker<T> invoker : selected) {
if ((invoker.isAvailable()) // available first
&& !reselectInvokers.contains(invoker)) {
reselectInvokers.add(invoker);
}
if (selected != null) {
for (Invoker<T> invoker : selected) {
if ((invoker.isAvailable()) // available first
&& !reselectInvokers.contains(invoker)) {
reselectInvokers.add(invoker);
}
}
if (!reselectInvokers.isEmpty()) {
return loadbalance.select(reselectInvokers, getUrl(), invocation);
}
}
if (!reselectInvokers.isEmpty()) {
return loadbalance.select(reselectInvokers, getUrl(), invocation);
}

return null;
}

Expand Down

0 comments on commit 59621f5

Please sign in to comment.