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
d1febbf8
Commit
d1febbf8
authored
May 31, 2016
by
Jason Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc fix
parent
3e4e8ef9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
RemoteConfigRepository.java
...ip/framework/apollo/internals/RemoteConfigRepository.java
+9
-12
No files found.
apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigRepository.java
View file @
d1febbf8
...
...
@@ -55,6 +55,7 @@ public class RemoteConfigRepository extends AbstractConfigRepository {
private
volatile
AtomicReference
<
ApolloConfig
>
m_configCache
;
private
final
String
m_namespace
;
private
final
ScheduledExecutorService
m_executorService
;
private
final
ExecutorService
m_longPollingService
;
private
final
AtomicBoolean
m_longPollingStopped
;
private
SchedulePolicy
m_longPollSchedulePolicy
;
private
AtomicReference
<
ServiceDTO
>
m_longPollServiceDto
;
...
...
@@ -80,6 +81,8 @@ public class RemoteConfigRepository extends AbstractConfigRepository {
m_longPollingStopped
=
new
AtomicBoolean
(
false
);
m_executorService
=
Executors
.
newScheduledThreadPool
(
1
,
ApolloThreadFactory
.
create
(
"RemoteConfigRepository"
,
true
));
m_longPollingService
=
Executors
.
newFixedThreadPool
(
2
,
ApolloThreadFactory
.
create
(
"RemoteConfigRepository-LongPolling"
,
true
));
m_longPollServiceDto
=
new
AtomicReference
<>();
this
.
trySync
();
this
.
schedulePeriodicRefresh
();
...
...
@@ -211,15 +214,12 @@ public class RemoteConfigRepository extends AbstractConfigRepository {
private
String
assembleQueryConfigUrl
(
String
uri
,
String
appId
,
String
cluster
,
String
namespace
,
String
dataCenter
,
ApolloConfig
previousConfig
)
{
Escaper
escaper
=
UrlEscapers
.
urlPathSegmentEscaper
();
String
path
=
"configs/%s/%s"
;
List
<
String
>
pathParams
=
Lists
.
newArrayList
(
escaper
.
escape
(
appId
),
escaper
.
escape
(
cluster
));
String
path
=
"configs/%s/%s/%s"
;
List
<
String
>
pathParams
=
Lists
.
newArrayList
(
escaper
.
escape
(
appId
),
escaper
.
escape
(
cluster
),
escaper
.
escape
(
namespace
));
Map
<
String
,
String
>
queryParams
=
Maps
.
newHashMap
();
if
(!
Strings
.
isNullOrEmpty
(
namespace
))
{
path
=
path
+
"/%s"
;
pathParams
.
add
(
escaper
.
escape
(
namespace
));
}
if
(
previousConfig
!=
null
)
{
queryParams
.
put
(
"releaseKey"
,
escaper
.
escape
(
String
.
valueOf
(
previousConfig
.
getReleaseKey
())));
}
...
...
@@ -248,13 +248,10 @@ public class RemoteConfigRepository extends AbstractConfigRepository {
final
String
appId
=
m_configUtil
.
getAppId
();
final
String
cluster
=
m_configUtil
.
getCluster
();
final
String
dataCenter
=
m_configUtil
.
getDataCenter
();
final
ExecutorService
longPollingService
=
Executors
.
newFixedThreadPool
(
2
,
ApolloThreadFactory
.
create
(
"RemoteConfigRepository-LongPolling"
,
true
));
longPollingService
.
submit
(
new
Runnable
()
{
m_longPollingService
.
submit
(
new
Runnable
()
{
@Override
public
void
run
()
{
doLongPollingRefresh
(
appId
,
cluster
,
dataCenter
,
longPollingService
);
doLongPollingRefresh
(
appId
,
cluster
,
dataCenter
,
m_
longPollingService
);
}
});
}
...
...
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