fix : Redefine the behavior of base and subclasses (#657)

pull/661/head
十大才子之首 2 years ago committed by GitHub
parent a92656ecca
commit abf25874d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -81,15 +81,7 @@ public abstract class AbstractRefreshListener<M> implements RefreshListener<Hipp
*/
@Override
public boolean match(M properties) {
return false;
}
/**
* check all
*
* @param nodes nodes
*/
protected boolean checkArray(String nodes) {
String nodes = getNodes(properties);
if (StringUtil.isEmpty(nodes) || ALL.equals(nodes)) {
return true;
}
@ -101,6 +93,16 @@ public abstract class AbstractRefreshListener<M> implements RefreshListener<Hipp
.anyMatch(i -> i.check(ipSegment, port));
}
/**
* get nodes in new properties
*
* @param properties new properties
* @return nodes in properties
*/
protected String getNodes(M properties) {
return ALL;
}
/**
* ip + port
*/

@ -42,9 +42,8 @@ import static cn.hippo4j.config.springboot.starter.refresher.event.Hippo4jConfig
public class AdapterExecutorsRefreshListener extends AbstractRefreshListener<AdapterExecutorProperties> {
@Override
public boolean match(AdapterExecutorProperties properties) {
String nodes = properties.getNodes();
return checkArray(nodes);
public String getNodes(AdapterExecutorProperties properties) {
return properties.getNodes();
}
@Override

@ -21,6 +21,7 @@ import cn.hippo4j.common.executor.support.BlockingQueueTypeEnum;
import cn.hippo4j.common.executor.support.RejectedPolicyTypeEnum;
import cn.hippo4j.common.executor.support.ResizableCapacityLinkedBlockingQueue;
import cn.hippo4j.common.toolkit.CollectionUtil;
import cn.hippo4j.config.springboot.starter.config.AdapterExecutorProperties;
import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties;
import cn.hippo4j.config.springboot.starter.config.ExecutorProperties;
import cn.hippo4j.config.springboot.starter.notify.CoreNotifyConfigBuilder;
@ -68,9 +69,8 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
private final Hippo4jBaseSendMessageService hippo4jBaseSendMessageService;
@Override
public boolean match(ExecutorProperties properties) {
String nodes = properties.getNodes();
return checkArray(nodes);
public String getNodes(ExecutorProperties properties) {
return properties.getNodes();
}
@Override

@ -39,9 +39,8 @@ import static cn.hippo4j.config.springboot.starter.refresher.event.Hippo4jConfig
public class WebExecutorRefreshListener extends AbstractRefreshListener<WebThreadPoolProperties> {
@Override
public boolean match(WebThreadPoolProperties properties) {
String nodes = properties.getNodes();
return checkArray(nodes);
public String getNodes(WebThreadPoolProperties properties) {
return properties.getNodes();
}
@Override

Loading…
Cancel
Save