Java Code Examples for com.alibaba.csp.sentinel.util.AppNameUtil#getAppName()

The following examples show how to use com.alibaba.csp.sentinel.util.AppNameUtil#getAppName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SentinelConfigLoader.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 5 votes vote down vote up
private static void load() {
    String fileName = System.getProperty(SENTINEL_CONFIG);
    if (StringUtil.isBlank(fileName)) {
        fileName = DEFAULT_SENTINEL_CONFIG_FILE;
    }

    Properties p = ConfigUtil.loadProperties(fileName);

    // Compatible with legacy config file path.
    if (p == null) {
        String path = addSeparator(System.getProperty(USER_HOME)) + DIR_NAME + File.separator;
        fileName = path + AppNameUtil.getAppName() + ".properties";
        File file = new File(fileName);
        if (file.exists()) {
            p = ConfigUtil.loadProperties(fileName);
        }
    }

    if (p != null && !p.isEmpty()) {
        RecordLog.info("[SentinelConfigLoader] Loading Sentinel config from " + fileName);
        properties.putAll(p);
    }

    for (Map.Entry<Object, Object> entry : new CopyOnWriteArraySet<>(System.getProperties().entrySet())) {
        String configKey = entry.getKey().toString();
        String newConfigValue = entry.getValue().toString();
        String oldConfigValue = properties.getProperty(configKey);
        properties.put(configKey, newConfigValue);
        if (oldConfigValue != null) {
            RecordLog.info("[SentinelConfigLoader] JVM parameter overrides {0}: {1} -> {2}",
                    configKey, oldConfigValue, newConfigValue);
        }
    }
}
 
Example 2
Source File: ConfigSupplierRegistry.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 4 votes vote down vote up
@Override
public String get() {
    return AppNameUtil.getAppName();
}
 
Example 3
Source File: SentinelConfig.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 4 votes vote down vote up
public static String getAppName() {
    return AppNameUtil.getAppName();
}
 
Example 4
Source File: ConfigSupplierRegistry.java    From Sentinel with Apache License 2.0 4 votes vote down vote up
@Override
public String get() {
    return AppNameUtil.getAppName();
}