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
a1ac97b4
Commit
a1ac97b4
authored
Jun 20, 2017
by
张乐
Committed by
GitHub
Jun 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #645 from nobodyiam/admin-service-address-locator
use RestTemplateFactory to create rest template
parents
8db5e264
0cddf9cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
13 deletions
+3
-13
AdminServiceAddressLocator.java
...k/apollo/portal/component/AdminServiceAddressLocator.java
+3
-13
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/AdminServiceAddressLocator.java
View file @
a1ac97b4
...
...
@@ -32,7 +32,6 @@ import javax.annotation.PostConstruct;
@Component
public
class
AdminServiceAddressLocator
{
private
static
final
int
DEFAULT_TIMEOUT_MS
=
1000
;
private
static
final
long
NORMAL_REFRESH_INTERVAL
=
5
*
60
*
1000
;
private
static
final
long
OFFLINE_REFRESH_INTERVAL
=
10
*
1000
;
private
static
final
int
RETRY_TIMES
=
3
;
...
...
@@ -48,24 +47,15 @@ public class AdminServiceAddressLocator {
private
HttpMessageConverters
httpMessageConverters
;
@Autowired
private
PortalSettings
portalSettings
;
@Autowired
private
RestTemplateFactory
restTemplateFactory
;
@PostConstruct
public
void
init
()
{
allEnvs
=
portalSettings
.
getAllEnvs
();
//init restTemplate
restTemplate
=
new
RestTemplate
(
httpMessageConverters
.
getConverters
());
if
(
restTemplate
.
getRequestFactory
()
instanceof
SimpleClientHttpRequestFactory
)
{
SimpleClientHttpRequestFactory
rf
=
(
SimpleClientHttpRequestFactory
)
restTemplate
.
getRequestFactory
();
rf
.
setReadTimeout
(
DEFAULT_TIMEOUT_MS
);
rf
.
setConnectTimeout
(
DEFAULT_TIMEOUT_MS
);
}
else
if
(
restTemplate
.
getRequestFactory
()
instanceof
HttpComponentsClientHttpRequestFactory
)
{
HttpComponentsClientHttpRequestFactory
rf
=
(
HttpComponentsClientHttpRequestFactory
)
restTemplate
.
getRequestFactory
();
rf
.
setReadTimeout
(
DEFAULT_TIMEOUT_MS
);
rf
.
setConnectTimeout
(
DEFAULT_TIMEOUT_MS
);
}
restTemplate
=
restTemplateFactory
.
getObject
();
refreshServiceAddressService
=
Executors
.
newScheduledThreadPool
(
1
,
ApolloThreadFactory
.
create
(
"ServiceLocator"
,
false
));
...
...
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