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
3a71a4e8
Commit
3a71a4e8
authored
Jun 15, 2016
by
Jason Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor demo
parent
5021009a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
15 deletions
+3
-15
ApolloConfigDemo.java
apollo-demo/src/main/java/ApolloConfigDemo.java
+3
-15
No files found.
apollo-demo/src/main/java/ApolloConfigDemo.java
View file @
3a71a4e8
...
...
@@ -14,20 +14,19 @@ import java.io.InputStreamReader;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public
class
ApolloConfigDemo
implements
ConfigChangeListener
{
public
class
ApolloConfigDemo
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApolloConfigDemo
.
class
);
private
Config
config
;
public
ApolloConfigDemo
()
{
config
=
ConfigService
.
getAppConfig
();
config
.
addChangeListener
(
this
);
config
.
addChangeListener
(
new
ConfigChangeListener
()
{
@Override
public
void
onChange
(
ConfigChangeEvent
changeEvent
)
{
logger
.
info
(
"Changes
2
for namespace {}"
,
changeEvent
.
getNamespace
());
logger
.
info
(
"Changes for namespace {}"
,
changeEvent
.
getNamespace
());
for
(
String
key
:
changeEvent
.
changedKeys
())
{
ConfigChange
change
=
changeEvent
.
getChange
(
key
);
logger
.
info
(
"Change
2
- key: {}, oldValue: {}, newValue: {}, changeType: {}"
,
logger
.
info
(
"Change - key: {}, oldValue: {}, newValue: {}, changeType: {}"
,
change
.
getPropertyName
(),
change
.
getOldValue
(),
change
.
getNewValue
(),
change
.
getChangeType
());
}
...
...
@@ -58,15 +57,4 @@ public class ApolloConfigDemo implements ConfigChangeListener {
apolloConfigDemo
.
getConfig
(
input
);
}
}
@Override
public
void
onChange
(
ConfigChangeEvent
changeEvent
)
{
logger
.
info
(
"Changes for namespace {}"
,
changeEvent
.
getNamespace
());
for
(
String
key
:
changeEvent
.
changedKeys
())
{
ConfigChange
change
=
changeEvent
.
getChange
(
key
);
logger
.
info
(
"Change - key: {}, oldValue: {}, newValue: {}, changeType: {}"
,
change
.
getPropertyName
(),
change
.
getOldValue
(),
change
.
getNewValue
(),
change
.
getChangeType
());
}
}
}
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