Commit 099f5781 by Nepxion

增加动态版本设置

parent 4fa83117
...@@ -52,7 +52,22 @@ public class VersionEndpoint implements MvcEndpoint { ...@@ -52,7 +52,22 @@ public class VersionEndpoint implements MvcEndpoint {
return ResponseEntity.ok().body("OK"); return ResponseEntity.ok().body("OK");
} }
// 查看当前服务的动态版本和动态版本 // 清除当前服务的动态版本
@RequestMapping(path = "clear", method = RequestMethod.GET)
@ResponseBody
@ManagedOperation
public ResponseEntity<?> clear() {
Boolean discoveryControlEnabled = pluginContextAware.isDiscoveryControlEnabled();
if (!discoveryControlEnabled) {
return new ResponseEntity<>(Collections.singletonMap("Message", "Discovery control is disabled"), HttpStatus.NOT_FOUND);
}
pluginAdapter.clearDynamicVersion();
return ResponseEntity.ok().body("OK");
}
// 查看当前服务的本地版本和动态版本
@RequestMapping(path = "view", method = RequestMethod.GET) @RequestMapping(path = "view", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ManagedOperation @ManagedOperation
......
...@@ -38,4 +38,9 @@ public abstract class AbstractPluginAdapter implements PluginAdapter { ...@@ -38,4 +38,9 @@ public abstract class AbstractPluginAdapter implements PluginAdapter {
public void setDynamicVersion(String version) { public void setDynamicVersion(String version) {
pluginCache.put(PluginConstant.VERSION, version); pluginCache.put(PluginConstant.VERSION, version);
} }
@Override
public void clearDynamicVersion() {
pluginCache.clear(PluginConstant.VERSION);
}
} }
\ No newline at end of file
...@@ -23,4 +23,6 @@ public interface PluginAdapter { ...@@ -23,4 +23,6 @@ public interface PluginAdapter {
String getDynamicVersion(); String getDynamicVersion();
void setDynamicVersion(String version); void setDynamicVersion(String version);
void clearDynamicVersion();
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment