Merge remote-tracking branch 'upstream/develop' into develop

# Conflicts:
#	hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/DynamicThreadPoolCoreAutoConfiguration.java
#	hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java
#	hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosCloudRefresherHandler.java
#	hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosRefresherHandler.java
pull/120/head
weihu 3 years ago
commit d4f7e61188

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=renderer content=webkit><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/favicon.ico><title>Hippo4J Web</title><link href=/static/css/chunk-libs.3dfb7769.css rel=stylesheet><link href=/static/css/app.e182b999.css rel=stylesheet></head><body><div id=app></div><script src=/static/js/chunk-elementUI.bc99dd6f.js></script><script src=/static/js/chunk-libs.75ab222e.js></script><script>(function(e){function n(n){for(var t,r,o=n[0],d=n[1],f=n[2],h=0,i=[];h<o.length;h++)r=o[h],u[r]&&i.push(u[r][0]),u[r]=0;for(t in d)Object.prototype.hasOwnProperty.call(d,t)&&(e[t]=d[t]);l&&l(n);while(i.length)i.shift()();return a.push.apply(a,f||[]),c()}function c(){for(var e,n=0;n<a.length;n++){for(var c=a[n],t=!0,r=1;r<c.length;r++){var o=c[r];0!==u[o]&&(t=!1)}t&&(a.splice(n--,1),e=d(d.s=c[0]))}return e}var t={},r={runtime:0},u={runtime:0},a=[];function o(e){return d.p+"static/js/"+({}[e]||e)+"."+{"chunk-04a4268a":"c9a819e9","chunk-1504cdfc":"10f6cf66","chunk-16eb7b18":"68f99a5b","chunk-22b469c6":"83b14289","chunk-2d230fe7":"19def69d","chunk-380263e8":"efb9ddd4","chunk-45e73af7":"dd61708c","chunk-4934959c":"cb4ed23b","chunk-4b345e33":"779d562d","chunk-5af73d8a":"368ed4f8","chunk-648295c6":"b27237b1","chunk-6f742c38":"47b5bb28","chunk-91584750":"81deb5be","chunk-a6de055c":"0aed52f9","chunk-bc53b446":"6993c4c9","chunk-434632c4":"32bd5259","chunk-e25b23da":"15e2c94d","chunk-faec035c":"3b8de3ec"}[e]+".js"}function d(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,d),c.l=!0,c.exports}d.e=function(e){var n=[],c={"chunk-1504cdfc":1,"chunk-16eb7b18":1,"chunk-22b469c6":1,"chunk-380263e8":1,"chunk-45e73af7":1,"chunk-4934959c":1,"chunk-4b345e33":1,"chunk-5af73d8a":1,"chunk-648295c6":1,"chunk-6f742c38":1,"chunk-91584750":1,"chunk-a6de055c":1,"chunk-bc53b446":1,"chunk-434632c4":1,"chunk-e25b23da":1,"chunk-faec035c":1};r[e]?n.push(r[e]):0!==r[e]&&c[e]&&n.push(r[e]=new Promise((function(n,c){for(var t="static/css/"+({}[e]||e)+"."+{"chunk-04a4268a":"31d6cfe0","chunk-1504cdfc":"febaf7ae","chunk-16eb7b18":"6d24dacd","chunk-22b469c6":"bed88cae","chunk-2d230fe7":"31d6cfe0","chunk-380263e8":"6d24dacd","chunk-45e73af7":"5f8941eb","chunk-4934959c":"6d24dacd","chunk-4b345e33":"6d24dacd","chunk-5af73d8a":"31b32151","chunk-648295c6":"6d24dacd","chunk-6f742c38":"454dc39d","chunk-91584750":"13a7e89e","chunk-a6de055c":"9905f991","chunk-bc53b446":"55a106d0","chunk-434632c4":"adc5827d","chunk-e25b23da":"6d24dacd","chunk-faec035c":"98142e55"}[e]+".css",u=d.p+t,a=document.getElementsByTagName("link"),o=0;o<a.length;o++){var f=a[o],h=f.getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(h===t||h===u))return n()}var i=document.getElementsByTagName("style");for(o=0;o<i.length;o++){f=i[o],h=f.getAttribute("data-href");if(h===t||h===u)return n()}var l=document.createElement("link");l.rel="stylesheet",l.type="text/css",l.onload=n,l.onerror=function(n){var t=n&&n.target&&n.target.src||u,a=new Error("Loading CSS chunk "+e+" failed.\n("+t+")");a.request=t,delete r[e],l.parentNode.removeChild(l),c(a)},l.href=u;var b=document.getElementsByTagName("head")[0];b.appendChild(l)})).then((function(){r[e]=0})));var t=u[e];if(0!==t)if(t)n.push(t[2]);else{var a=new Promise((function(n,c){t=u[e]=[n,c]}));n.push(t[2]=a);var f,h=document.createElement("script");h.charset="utf-8",h.timeout=120,d.nc&&h.setAttribute("nonce",d.nc),h.src=o(e),f=function(n){h.onerror=h.onload=null,clearTimeout(i);var c=u[e];if(0!==c){if(c){var t=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src,a=new Error("Loading chunk "+e+" failed.\n("+t+": "+r+")");a.type=t,a.request=r,c[1](a)}u[e]=void 0}};var i=setTimeout((function(){f({type:"timeout",target:h})}),12e4);h.onerror=h.onload=f,document.head.appendChild(h)}return Promise.all(n)},d.m=e,d.c=t,d.d=function(e,n,c){d.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:c})},d.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.t=function(e,n){if(1&n&&(e=d(e)),8&n)return e;if(4&n&&"object"===typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(d.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var t in e)d.d(c,t,function(n){return e[n]}.bind(null,t));return c},d.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return d.d(n,"a",n),n},d.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},d.p="/",d.oe=function(e){throw console.error(e),e};var f=window["webpackJsonp"]=window["webpackJsonp"]||[],h=f.push.bind(f);f.push=n,f=f.slice();for(var i=0;i<f.length;i++)n(f[i]);var l=h;c()})([]);</script><script src=/static/js/app.bf670fba.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=renderer content=webkit><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/favicon.ico><title>Hippo4J Web</title><link href=/static/css/chunk-libs.3dfb7769.css rel=stylesheet><link href=/static/css/app.e182b999.css rel=stylesheet></head><body><div id=app></div><script src=/static/js/chunk-elementUI.bc99dd6f.js></script><script src=/static/js/chunk-libs.75ab222e.js></script><script>(function(e){function n(n){for(var t,r,o=n[0],d=n[1],f=n[2],h=0,i=[];h<o.length;h++)r=o[h],u[r]&&i.push(u[r][0]),u[r]=0;for(t in d)Object.prototype.hasOwnProperty.call(d,t)&&(e[t]=d[t]);l&&l(n);while(i.length)i.shift()();return a.push.apply(a,f||[]),c()}function c(){for(var e,n=0;n<a.length;n++){for(var c=a[n],t=!0,r=1;r<c.length;r++){var o=c[r];0!==u[o]&&(t=!1)}t&&(a.splice(n--,1),e=d(d.s=c[0]))}return e}var t={},r={runtime:0},u={runtime:0},a=[];function o(e){return d.p+"static/js/"+({}[e]||e)+"."+{"chunk-04a4268a":"c9a819e9","chunk-1504cdfc":"10f6cf66","chunk-16eb7b18":"f972e32c","chunk-22b469c6":"83b14289","chunk-2d230fe7":"19def69d","chunk-380263e8":"efb9ddd4","chunk-45e73af7":"dd61708c","chunk-4934959c":"cb4ed23b","chunk-4b345e33":"779d562d","chunk-5af73d8a":"368ed4f8","chunk-648295c6":"b36e1548","chunk-6f742c38":"47b5bb28","chunk-91584750":"81deb5be","chunk-a6de055c":"0aed52f9","chunk-bc53b446":"6993c4c9","chunk-434632c4":"32bd5259","chunk-e25b23da":"cd797eb1","chunk-faec035c":"3b8de3ec"}[e]+".js"}function d(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,d),c.l=!0,c.exports}d.e=function(e){var n=[],c={"chunk-1504cdfc":1,"chunk-16eb7b18":1,"chunk-22b469c6":1,"chunk-380263e8":1,"chunk-45e73af7":1,"chunk-4934959c":1,"chunk-4b345e33":1,"chunk-5af73d8a":1,"chunk-648295c6":1,"chunk-6f742c38":1,"chunk-91584750":1,"chunk-a6de055c":1,"chunk-bc53b446":1,"chunk-434632c4":1,"chunk-e25b23da":1,"chunk-faec035c":1};r[e]?n.push(r[e]):0!==r[e]&&c[e]&&n.push(r[e]=new Promise((function(n,c){for(var t="static/css/"+({}[e]||e)+"."+{"chunk-04a4268a":"31d6cfe0","chunk-1504cdfc":"febaf7ae","chunk-16eb7b18":"6d24dacd","chunk-22b469c6":"bed88cae","chunk-2d230fe7":"31d6cfe0","chunk-380263e8":"6d24dacd","chunk-45e73af7":"5f8941eb","chunk-4934959c":"6d24dacd","chunk-4b345e33":"6d24dacd","chunk-5af73d8a":"31b32151","chunk-648295c6":"6d24dacd","chunk-6f742c38":"454dc39d","chunk-91584750":"13a7e89e","chunk-a6de055c":"9905f991","chunk-bc53b446":"55a106d0","chunk-434632c4":"adc5827d","chunk-e25b23da":"6d24dacd","chunk-faec035c":"98142e55"}[e]+".css",u=d.p+t,a=document.getElementsByTagName("link"),o=0;o<a.length;o++){var f=a[o],h=f.getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(h===t||h===u))return n()}var i=document.getElementsByTagName("style");for(o=0;o<i.length;o++){f=i[o],h=f.getAttribute("data-href");if(h===t||h===u)return n()}var l=document.createElement("link");l.rel="stylesheet",l.type="text/css",l.onload=n,l.onerror=function(n){var t=n&&n.target&&n.target.src||u,a=new Error("Loading CSS chunk "+e+" failed.\n("+t+")");a.request=t,delete r[e],l.parentNode.removeChild(l),c(a)},l.href=u;var b=document.getElementsByTagName("head")[0];b.appendChild(l)})).then((function(){r[e]=0})));var t=u[e];if(0!==t)if(t)n.push(t[2]);else{var a=new Promise((function(n,c){t=u[e]=[n,c]}));n.push(t[2]=a);var f,h=document.createElement("script");h.charset="utf-8",h.timeout=120,d.nc&&h.setAttribute("nonce",d.nc),h.src=o(e),f=function(n){h.onerror=h.onload=null,clearTimeout(i);var c=u[e];if(0!==c){if(c){var t=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src,a=new Error("Loading chunk "+e+" failed.\n("+t+": "+r+")");a.type=t,a.request=r,c[1](a)}u[e]=void 0}};var i=setTimeout((function(){f({type:"timeout",target:h})}),12e4);h.onerror=h.onload=f,document.head.appendChild(h)}return Promise.all(n)},d.m=e,d.c=t,d.d=function(e,n,c){d.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:c})},d.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.t=function(e,n){if(1&n&&(e=d(e)),8&n)return e;if(4&n&&"object"===typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(d.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var t in e)d.d(c,t,function(n){return e[n]}.bind(null,t));return c},d.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return d.d(n,"a",n),n},d.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},d.p="/",d.oe=function(e){throw console.error(e),e};var f=window["webpackJsonp"]=window["webpackJsonp"]||[],h=f.push.bind(f);f.push=n,f=f.slice();for(var i=0;i<f.length;i++)n(f[i]);var l=h;c()})([]);</script><script src=/static/js/app.bf670fba.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,18 @@
package cn.hippo4j.core.starter.refresher.config;
import java.util.Map;
/**
*
*
* @author serenity SerenitySir@outlook.com
* @since 2022/2/28
*/
public interface ConfigParser {
/**
*
* @param content
* @return k,v
*/
Map<Object, Object> parseConfig(String content);
}

@ -0,0 +1,37 @@
package cn.hippo4j.core.starter.refresher.config.impl;
import cn.hippo4j.core.starter.refresher.config.ConfigParser;
import com.google.common.collect.Maps;
import lombok.SneakyThrows;
import org.springframework.util.StringUtils;
import java.io.StringReader;
import java.util.Map;
import java.util.Properties;
/**
* Properties
*
* @author serenity SerenitySir@outlook.com
* @since 2022/2/28
*/
public class PropConfigParser implements ConfigParser {
@SneakyThrows
@Override
public Map<Object, Object> parseConfig(String content) {
if (!StringUtils.hasText(content)){
return Maps.newHashMap();
}
Properties properties = new Properties();
properties.load(new StringReader(content));
return properties;
}
public static void main(String[] args) {
ConfigParser propConfigParser = new PropConfigParser();
Map<Object, Object> map = propConfigParser.parseConfig("db.aa=11\ndb.bb=22");
System.out.println(map.toString());
}
}

@ -0,0 +1,32 @@
package cn.hippo4j.core.starter.refresher.config.impl;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.core.starter.refresher.config.ConfigParser;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.io.ByteArrayResource;
import java.util.Map;
/**
* Yml
*
* @author serenity SerenitySir@outlook.com
* @since 2022/2/28
*/
public class YmlConfigParser implements ConfigParser {
@Override
public Map<Object, Object> parseConfig(String content) {
Map<Object, Object> resultMap = Maps.newHashMap();
if (StringUtil.isBlank(content)) {
return resultMap;
}
YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
yamlPropertiesFactoryBean.setResources(new ByteArrayResource(content.getBytes()));
resultMap = yamlPropertiesFactoryBean.getObject();
return resultMap;
}
}

@ -152,7 +152,8 @@ public class DynamicThreadPoolAutoConfiguration {
@Bean
@ConditionalOnBean(name = JETTY_SERVLET_WEB_SERVER_FACTORY)
public JettyWebThreadPoolHandler jettyWebThreadPoolHandler() {return new JettyWebThreadPoolHandler();
public JettyWebThreadPoolHandler jettyWebThreadPoolHandler() {
return new JettyWebThreadPoolHandler();
}
@Bean
@ -161,7 +162,6 @@ public class DynamicThreadPoolAutoConfiguration {
return new UndertowWebThreadPoolHandler();
}
@Bean
public WebThreadPoolHandlerChoose webThreadPoolServiceChoose() {
return new WebThreadPoolHandlerChoose();

@ -44,5 +44,4 @@ public abstract class AbstractWebThreadPoolService implements WebThreadPoolServi
return executor;
}
}

@ -16,8 +16,6 @@ import java.util.concurrent.Executor;
@Slf4j
public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService {
@Override
protected Executor getWebThreadPoolByServer(WebServer webServer) {
JettyWebServer jettyWebServer = (JettyWebServer) webServer;
@ -33,6 +31,7 @@ public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService{
Integer maxSize = poolParameterInfo.getMaxSize();
jettyExecutor.setMinThreads(coreSize);
jettyExecutor.setMaxThreads(maxSize);
log.info(
"🔥 Changed web thread pool. coreSize :: [{}], maxSize :: [{}]",
String.format("%s => %s", jettyExecutor.getMinThreads(), coreSize),
@ -41,8 +40,6 @@ public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService{
} catch (Exception ex) {
log.error("Failed to modify the jetty thread pool parameter.", ex);
}
}
}

@ -21,7 +21,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
@AllArgsConstructor
public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService {
private final AtomicBoolean cacheFlag = new AtomicBoolean(Boolean.FALSE);
private static String EXCEPTION_MESSAGE;
@ -52,17 +51,17 @@ public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService{
tomcatExecutor.setCorePoolSize(poolParameterInfo.getCoreSize());
tomcatExecutor.setMaximumPoolSize(poolParameterInfo.getMaxSize());
tomcatExecutor.setKeepAliveTime(poolParameterInfo.getKeepAliveTime(), TimeUnit.SECONDS);
int originalCoreSize = tomcatExecutor.getCorePoolSize();
int originalMaximumPoolSize = tomcatExecutor.getMaximumPoolSize();
long originalKeepAliveTime = tomcatExecutor.getKeepAliveTime(TimeUnit.SECONDS);
log.info(
"🔥 Changed web thread pool. coreSize :: [{}], maxSize :: [{}], keepAliveTime :: [{}]",
String.format("%s => %s", originalCoreSize, poolParameterInfo.getCoreSize()),
String.format("%s => %s", originalMaximumPoolSize, poolParameterInfo.getMaxSize()),
String.format("%s => %s", originalKeepAliveTime, poolParameterInfo.getKeepAliveTime())
);
} catch (Exception ex) {
log.error("Failed to modify the Tomcat thread pool parameter.", ex);
}

@ -60,7 +60,6 @@ public class UndertowWebThreadPoolHandler extends AbstractWebThreadPoolService {
} catch (Exception ex) {
log.error("Failed to modify the undertow thread pool parameter.", ex);
}
}
}

Loading…
Cancel
Save