Commit 782796c9 by Jason Song

shuffle admin services to achieve load balance

parent e0fcbb9f
...@@ -20,6 +20,7 @@ import org.springframework.web.util.DefaultUriTemplateHandler; ...@@ -20,6 +20,7 @@ import org.springframework.web.util.DefaultUriTemplateHandler;
import org.springframework.web.util.UriTemplateHandler; import org.springframework.web.util.UriTemplateHandler;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
...@@ -77,6 +78,8 @@ public class RetryableRestTemplate { ...@@ -77,6 +78,8 @@ public class RetryableRestTemplate {
ct.complete(); ct.complete();
throw e; throw e;
} }
//randomly load balance
Collections.shuffle(services);
for (ServiceDTO serviceDTO : services) { for (ServiceDTO serviceDTO : services) {
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment