Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
ba6c1699
Commit
ba6c1699
authored
Jul 21, 2016
by
张乐
Committed by
GitHub
Jul 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #337 from nobodyiam/shuffle-admin-services
Shuffle admin services
parents
e0fcbb9f
b75db7af
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
AdminServiceAddressLocator.java
...amework/apollo/portal/api/AdminServiceAddressLocator.java
+11
-1
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAddressLocator.java
View file @
ba6c1699
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
api
;
import
com.google.common.collect.Lists
;
import
com.ctrip.framework.apollo.core.MetaDomainConsts
;
import
com.ctrip.framework.apollo.core.dto.ServiceDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
...
...
@@ -11,9 +13,11 @@ import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import
org.springframework.http.client.HttpComponentsClientHttpRequestFactory
;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -67,7 +71,13 @@ public class AdminServiceAddressLocator {
}
public
List
<
ServiceDTO
>
getServiceList
(
Env
env
)
{
return
cache
.
get
(
env
);
List
<
ServiceDTO
>
services
=
cache
.
get
(
env
);
if
(
CollectionUtils
.
isEmpty
(
services
))
{
return
Collections
.
EMPTY_LIST
;
}
List
<
ServiceDTO
>
randomConfigServices
=
Lists
.
newArrayList
(
services
);
Collections
.
shuffle
(
randomConfigServices
);
return
randomConfigServices
;
}
//Maintain admin server address
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment