Search in sources :

Example 1 with ThreadPoolProperties

use of com.dtp.common.config.ThreadPoolProperties in project dynamic-tp by dromara.

the class DtpRegistry method run.

@Override
public void run(ApplicationArguments args) {
    Set<String> remoteExecutors = Collections.emptySet();
    if (CollUtil.isNotEmpty(dtpProperties.getExecutors())) {
        remoteExecutors = dtpProperties.getExecutors().stream().map(ThreadPoolProperties::getThreadPoolName).collect(Collectors.toSet());
    }
    val registeredDtpExecutors = Sets.newHashSet(DTP_REGISTRY.keySet());
    val localDtpExecutors = CollUtil.subtract(registeredDtpExecutors, remoteExecutors);
    val localCommonExecutors = COMMON_REGISTRY.keySet();
    log.info("DtpRegistry initialization end, remote dtpExecutors: {}, local dtpExecutors: {}," + " local commonExecutors: {}", remoteExecutors, localDtpExecutors, localCommonExecutors);
    if (CollUtil.isEmpty(dtpProperties.getPlatforms())) {
        log.warn("DtpRegistry initialization end, no notify platforms configured.");
        DTP_REGISTRY.forEach((k, v) -> v.setNotifyItems(Collections.emptyList()));
        return;
    }
    DTP_REGISTRY.forEach((k, v) -> {
        NotifyHelper.fillPlatforms(dtpProperties.getPlatforms(), v.getNotifyItems());
        v.getNotifyItems().forEach(x -> {
            AlarmLimiter.initAlarmLimiter(k, x);
            AlarmCounter.init(k, x.getType());
        });
    });
}
Also used : lombok.val(lombok.val) ThreadPoolProperties(com.dtp.common.config.ThreadPoolProperties)

Aggregations

ThreadPoolProperties (com.dtp.common.config.ThreadPoolProperties)1 lombok.val (lombok.val)1