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

com.arextest.diff.model.SystemConfig Maven / Gradle / Ivy

The newest version!
package com.arextest.diff.model;

import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by rchen9 on 2022/12/22.
 */
public class SystemConfig {

  private static final Set ignoreNodeSet = new HashSet<>();
  private static boolean metricsEnable = true;

  static {
    try {
      InputStream in = SystemConfig.class.getResourceAsStream("/sdkConfig.properties");
      Properties properties = new Properties();
      properties.load(in);
      String ignoreNodes = properties.getProperty("ignore.nodes");
      if (StringUtils.isNotBlank(ignoreNodes)) {
        String[] split = ignoreNodes.split(",");
        ignoreNodeSet.addAll(Arrays.asList(split));
      }

      String metricsEnableStr = properties.getProperty("metrics.enable");
      if (StringUtils.isNotBlank(metricsEnableStr) && "false".equals(metricsEnableStr)) {
        metricsEnable = false;
      }
    } catch (Exception e) {
    }
  }

  public static Set getIgnoreNodeSet() {
    return ignoreNodeSet;
  }

  public static boolean isMetricsEnable() {
    return metricsEnable;
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy