Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈文顺
discovery
Commits
ebc2c4c0
Commit
ebc2c4c0
authored
Jun 25, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构事件总线
parent
4e1dd99f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
12 deletions
+11
-12
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/AdminEndpoint.java
+1
-1
discovery-plugin-config-center/src/main/java/com/nepxion/discovery/plugin/configcenter/ConfigAdapter.java
+2
-1
discovery-plugin-config-center/src/main/java/com/nepxion/discovery/plugin/configcenter/ConfigSubscriber.java
+1
-7
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/event/PluginPublisher.java
+7
-3
No files found.
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/AdminEndpoint.java
View file @
ebc2c4c0
...
@@ -79,7 +79,7 @@ public class AdminEndpoint extends AbstractMvcEndpoint {
...
@@ -79,7 +79,7 @@ public class AdminEndpoint extends AbstractMvcEndpoint {
try
{
try
{
InputStream
inputStream
=
IOUtils
.
toInputStream
(
config
,
PluginConstant
.
ENCODING_UTF_8
);
InputStream
inputStream
=
IOUtils
.
toInputStream
(
config
,
PluginConstant
.
ENCODING_UTF_8
);
pluginPublisher
.
p
ublish
(
inputStream
);
pluginPublisher
.
asyncP
ublish
(
inputStream
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
PluginException
(
"To input stream failed"
,
e
);
throw
new
PluginException
(
"To input stream failed"
,
e
);
}
}
...
...
discovery-plugin-config-center/src/main/java/com/nepxion/discovery/plugin/configcenter/ConfigAdapter.java
View file @
ebc2c4c0
...
@@ -21,6 +21,6 @@ public abstract class ConfigAdapter extends AbstractConfigLoader {
...
@@ -21,6 +21,6 @@ public abstract class ConfigAdapter extends AbstractConfigLoader {
private
PluginPublisher
pluginPublisher
;
private
PluginPublisher
pluginPublisher
;
public
void
publish
(
InputStream
inputStream
)
{
public
void
publish
(
InputStream
inputStream
)
{
pluginPublisher
.
p
ublish
(
inputStream
);
pluginPublisher
.
asyncP
ublish
(
inputStream
);
}
}
}
}
\ No newline at end of file
discovery-plugin-config-center/src/main/java/com/nepxion/discovery/plugin/configcenter/ConfigSubscriber.java
View file @
ebc2c4c0
...
@@ -18,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -18,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
com.google.common.eventbus.Subscribe
;
import
com.google.common.eventbus.Subscribe
;
import
com.nepxion.discovery.plugin.framework.context.PluginContextAware
;
import
com.nepxion.discovery.plugin.framework.context.PluginContextAware
;
import
com.nepxion.eventbus.annotation.EventBus
;
import
com.nepxion.eventbus.annotation.EventBus
;
import
com.nepxion.eventbus.core.Event
;
@EventBus
@EventBus
public
class
ConfigSubscriber
{
public
class
ConfigSubscriber
{
...
@@ -31,7 +30,7 @@ public class ConfigSubscriber {
...
@@ -31,7 +30,7 @@ public class ConfigSubscriber {
private
ConfigParser
configParser
;
private
ConfigParser
configParser
;
@Subscribe
@Subscribe
public
void
subscribe
(
Event
event
)
{
public
void
subscribe
(
InputStream
inputStream
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
Boolean
remoteConfigEnabled
=
pluginContextAware
.
isRemoteConfigEnabled
();
Boolean
remoteConfigEnabled
=
pluginContextAware
.
isRemoteConfigEnabled
();
...
@@ -47,12 +46,8 @@ public class ConfigSubscriber {
...
@@ -47,12 +46,8 @@ public class ConfigSubscriber {
return
;
return
;
}
}
Object
object
=
event
.
getSource
();
if
(
object
instanceof
InputStream
)
{
LOG
.
info
(
"********** Remote config change has been subscribed **********"
);
LOG
.
info
(
"********** Remote config change has been subscribed **********"
);
InputStream
inputStream
=
(
InputStream
)
object
;
configParser
.
parse
(
inputStream
);
configParser
.
parse
(
inputStream
);
}
}
}
}
}
\ No newline at end of file
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/event/PluginPublisher.java
View file @
ebc2c4c0
...
@@ -11,14 +11,17 @@ package com.nepxion.discovery.plugin.framework.event;
...
@@ -11,14 +11,17 @@ package com.nepxion.discovery.plugin.framework.event;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.nepxion.eventbus.core.Event
;
import
com.nepxion.eventbus.core.EventControllerFactory
;
import
com.nepxion.eventbus.core.EventControllerFactory
;
public
class
PluginPublisher
{
public
class
PluginPublisher
{
@Autowired
@Autowired
private
EventControllerFactory
eventControllerFactory
;
private
EventControllerFactory
eventControllerFactory
;
public
void
publish
(
Object
object
)
{
public
void
asyncPublish
(
Object
object
)
{
eventControllerFactory
.
getAsyncController
().
post
(
new
Event
(
object
));
eventControllerFactory
.
getAsyncController
().
post
(
object
);
}
public
void
syncPublish
(
Object
object
)
{
eventControllerFactory
.
getSyncController
().
post
(
object
);
}
}
}
}
\ No newline at end of file
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