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
6a682394
Commit
6a682394
authored
Jul 13, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构类结构
parent
e61ba693
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
7 deletions
+10
-7
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/RouterEndpoint.java
+1
-1
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/adapter/AbstractPluginAdapter.java
+5
-0
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/adapter/PluginAdapter.java
+2
-0
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/context/PluginContextAware.java
+0
-4
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/listener/discovery/VersionFilterDiscoveryListener.java
+1
-1
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/listener/loadbalance/VersionFilterLoadBalanceListener.java
+1
-1
No files found.
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/RouterEndpoint.java
View file @
6a682394
...
@@ -123,7 +123,7 @@ public class RouterEndpoint implements MvcEndpoint {
...
@@ -123,7 +123,7 @@ public class RouterEndpoint implements MvcEndpoint {
}
}
public
RouterEntity
getRouterEntity
()
{
public
RouterEntity
getRouterEntity
()
{
String
serviceId
=
plugin
ContextAware
.
getServiceId
();
String
serviceId
=
plugin
Adapter
.
getServiceId
();
String
version
=
pluginAdapter
.
getVersion
();
String
version
=
pluginAdapter
.
getVersion
();
String
host
=
pluginAdapter
.
getIpAddress
(
registration
);
String
host
=
pluginAdapter
.
getIpAddress
(
registration
);
int
port
=
pluginAdapter
.
getPort
(
registration
);
int
port
=
pluginAdapter
.
getPort
(
registration
);
...
...
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/adapter/AbstractPluginAdapter.java
View file @
6a682394
...
@@ -24,6 +24,11 @@ public abstract class AbstractPluginAdapter implements PluginAdapter {
...
@@ -24,6 +24,11 @@ public abstract class AbstractPluginAdapter implements PluginAdapter {
protected
PluginCache
pluginCache
;
protected
PluginCache
pluginCache
;
@Override
@Override
public
String
getServiceId
()
{
return
pluginContextAware
.
getEnvironment
().
getProperty
(
PluginConstant
.
SPRING_APPLICATION_NAME
);
}
@Override
public
String
getVersion
()
{
public
String
getVersion
()
{
String
dynamicVersion
=
getDynamicVersion
();
String
dynamicVersion
=
getDynamicVersion
();
if
(
StringUtils
.
isNotEmpty
(
dynamicVersion
))
{
if
(
StringUtils
.
isNotEmpty
(
dynamicVersion
))
{
...
...
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/adapter/PluginAdapter.java
View file @
6a682394
...
@@ -14,6 +14,8 @@ import org.springframework.cloud.client.serviceregistry.Registration;
...
@@ -14,6 +14,8 @@ import org.springframework.cloud.client.serviceregistry.Registration;
import
com.netflix.loadbalancer.Server
;
import
com.netflix.loadbalancer.Server
;
public
interface
PluginAdapter
{
public
interface
PluginAdapter
{
String
getServiceId
();
String
getIpAddress
(
Registration
registration
);
String
getIpAddress
(
Registration
registration
);
int
getPort
(
Registration
registration
);
int
getPort
(
Registration
registration
);
...
...
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/context/PluginContextAware.java
View file @
6a682394
...
@@ -84,10 +84,6 @@ public class PluginContextAware implements ApplicationContextAware {
...
@@ -84,10 +84,6 @@ public class PluginContextAware implements ApplicationContextAware {
return
environment
;
return
environment
;
}
}
public
String
getServiceId
()
{
return
environment
.
getProperty
(
PluginConstant
.
SPRING_APPLICATION_NAME
);
}
public
Boolean
isRegisterControlEnabled
()
{
public
Boolean
isRegisterControlEnabled
()
{
return
isRegisterControlEnabled
(
environment
);
return
isRegisterControlEnabled
(
environment
);
}
}
...
...
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/listener/discovery/VersionFilterDiscoveryListener.java
View file @
6a682394
...
@@ -28,7 +28,7 @@ import com.nepxion.discovery.plugin.framework.entity.VersionFilterEntity;
...
@@ -28,7 +28,7 @@ import com.nepxion.discovery.plugin.framework.entity.VersionFilterEntity;
public
class
VersionFilterDiscoveryListener
extends
AbstractDiscoveryListener
{
public
class
VersionFilterDiscoveryListener
extends
AbstractDiscoveryListener
{
@Override
@Override
public
void
onGetInstances
(
String
serviceId
,
List
<
ServiceInstance
>
instances
)
{
public
void
onGetInstances
(
String
serviceId
,
List
<
ServiceInstance
>
instances
)
{
String
consumerServiceId
=
plugin
ContextAware
.
getServiceId
();
String
consumerServiceId
=
plugin
Adapter
.
getServiceId
();
String
consumerServiceVersion
=
pluginAdapter
.
getVersion
();
String
consumerServiceVersion
=
pluginAdapter
.
getVersion
();
applyVersionFilter
(
consumerServiceId
,
consumerServiceVersion
,
serviceId
,
instances
);
applyVersionFilter
(
consumerServiceId
,
consumerServiceVersion
,
serviceId
,
instances
);
...
...
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/listener/loadbalance/VersionFilterLoadBalanceListener.java
View file @
6a682394
...
@@ -28,7 +28,7 @@ import com.netflix.loadbalancer.Server;
...
@@ -28,7 +28,7 @@ import com.netflix.loadbalancer.Server;
public
class
VersionFilterLoadBalanceListener
extends
AbstractLoadBalanceListener
{
public
class
VersionFilterLoadBalanceListener
extends
AbstractLoadBalanceListener
{
@Override
@Override
public
void
onGetServers
(
String
serviceId
,
List
<?
extends
Server
>
servers
)
{
public
void
onGetServers
(
String
serviceId
,
List
<?
extends
Server
>
servers
)
{
String
consumerServiceId
=
plugin
ContextAware
.
getServiceId
();
String
consumerServiceId
=
plugin
Adapter
.
getServiceId
();
String
consumerServiceVersion
=
pluginAdapter
.
getVersion
();
String
consumerServiceVersion
=
pluginAdapter
.
getVersion
();
applyVersionFilter
(
consumerServiceId
,
consumerServiceVersion
,
serviceId
,
servers
);
applyVersionFilter
(
consumerServiceId
,
consumerServiceVersion
,
serviceId
,
servers
);
...
...
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