All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qlangtech.tis.config.BasicConfig Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package com.qlangtech.tis.config;

import java.util.Map;
import java.util.Objects;
import java.util.ServiceLoader;

/**
 * @author: 百岁([email protected])
 * @create: 2023-08-07 17:39
 **/
public abstract class BasicConfig {
    public static final int LogFlumeAddressPORT = 41414;

    // 组装节点
    protected abstract String getAsbHost();

    public abstract Map getAllKV();

    private static BasicConfig baseConfig;

    public static BasicConfig getBaseConfig() {
        if (baseConfig == null) {
            ServiceLoader configLoader = ServiceLoader.load(BasicConfig.class);
            for (BasicConfig conf : configLoader) {
                baseConfig = conf;
                break;
            }
        }
        return Objects.requireNonNull(baseConfig, "baseConfig can not be null");
    }

    public static String getAssembleHost() {
        return getBaseConfig().getAsbHost();
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy