The zookeeper implementation adjusts the position of the code

pull/246/head
chen.ma 2 years ago
parent 8b12c9c237
commit 046123f3a2

@ -19,8 +19,6 @@ package cn.hippo4j.core.springboot.starter.refresher;
import cn.hippo4j.common.api.ThreadPoolDynamicRefresh;
import cn.hippo4j.common.config.ApplicationContextHolder;
import cn.hippo4j.common.notify.ThreadPoolNotifyAlarm;
import cn.hippo4j.core.executor.manage.GlobalNotifyAlarmManage;
import cn.hippo4j.core.executor.support.ThreadPoolBuilder;
import cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties;
import cn.hippo4j.core.springboot.starter.parser.ConfigParserHandler;
@ -56,19 +54,4 @@ public abstract class AbstractCoreThreadPoolDynamicRefresh implements ThreadPool
log.error("Hippo-4J core dynamic refresh failed.", ex);
}
}
/**
* Register notify alarm manage.
*/
public void registerNotifyAlarmManage() {
bootstrapCoreProperties.getExecutors().forEach(executorProperties -> {
ThreadPoolNotifyAlarm threadPoolNotifyAlarm = new ThreadPoolNotifyAlarm(
executorProperties.getNotify().getIsAlarm(),
executorProperties.getNotify().getCapacityAlarm(),
executorProperties.getNotify().getActiveAlarm());
threadPoolNotifyAlarm.setInterval(executorProperties.getNotify().getInterval());
threadPoolNotifyAlarm.setReceives(executorProperties.receives());
GlobalNotifyAlarmManage.put(executorProperties.getThreadPoolId(), threadPoolNotifyAlarm);
});
}
}

@ -17,6 +17,8 @@
package cn.hippo4j.core.springboot.starter.refresher;
import cn.hippo4j.common.notify.ThreadPoolNotifyAlarm;
import cn.hippo4j.core.executor.manage.GlobalNotifyAlarmManage;
import cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties;
import com.google.common.base.Charsets;
import lombok.extern.slf4j.Slf4j;
@ -107,4 +109,19 @@ public class ZookeeperRefresherHandler extends AbstractCoreThreadPoolDynamicRefr
log.error("load zk node error, nodePath is {}", nodePath, e);
}
}
/**
* Register notify alarm manage.
*/
public void registerNotifyAlarmManage() {
bootstrapCoreProperties.getExecutors().forEach(executorProperties -> {
ThreadPoolNotifyAlarm threadPoolNotifyAlarm = new ThreadPoolNotifyAlarm(
executorProperties.getNotify().getIsAlarm(),
executorProperties.getNotify().getCapacityAlarm(),
executorProperties.getNotify().getActiveAlarm());
threadPoolNotifyAlarm.setInterval(executorProperties.getNotify().getInterval());
threadPoolNotifyAlarm.setReceives(executorProperties.receives());
GlobalNotifyAlarmManage.put(executorProperties.getThreadPoolId(), threadPoolNotifyAlarm);
});
}
}

Loading…
Cancel
Save