mirror of https://github.com/longtai-cn/hippo4j
parent
82e1d6e8dd
commit
f5010e5ff8
@ -0,0 +1,23 @@
|
||||
package cn.hippo4j.core.starter.refresher;
|
||||
|
||||
import cn.hippo4j.common.api.ThreadPoolDynamicRefresh;
|
||||
import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* Core thread pool dynamic refresh.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2022/2/26 12:32
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class CoreThreadPoolDynamicRefresh implements ThreadPoolDynamicRefresh {
|
||||
|
||||
private final ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler;
|
||||
|
||||
@Override
|
||||
public void dynamicRefresh(String content) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.hippo4j.core.starter.refresher;
|
||||
|
||||
import com.alibaba.cloud.nacos.NacosConfigManager;
|
||||
import com.alibaba.nacos.api.config.listener.Listener;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Nacos cloud refresher handler.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2022/2/26 11:21
|
||||
*/
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class NacosCloudRefresherHandler implements InitializingBean, Listener {
|
||||
|
||||
private final NacosConfigManager nacosConfigManager;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
nacosConfigManager.getConfigService().addListener("hippo4j-nacos.yaml", "DEFAULT_GROUP", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Executor getExecutor() {
|
||||
return Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
log.info("Config :: {}", configInfo);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.hippo4j.core.starter.refresher;
|
||||
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import com.alibaba.nacos.api.config.listener.Listener;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Nacos refresher handler.
|
||||
*
|
||||
* @author chen.ma
|
||||
* @date 2022/2/26 00:10
|
||||
*/
|
||||
@Slf4j
|
||||
public class NacosRefresherHandler implements InitializingBean, Listener {
|
||||
|
||||
@Autowired(required = false)
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
configService.addListener("hippo4j-nacos.yaml", "DEFAULT_GROUP", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Executor getExecutor() {
|
||||
return Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
log.info("Config :: {}", configInfo);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue