library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java
public static void loadDnsCacheConfig(@Nonnull String propertiesFileName) {
        InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertiesFileName);
        if (inputStream == null) {
            inputStream = DnsCacheManipulator.class.getClassLoader().getResourceAsStream(propertiesFileName);
        }
        if (inputStream == null) {
            throw new DnsCacheManipulatorException("Fail to find " + propertiesFileName + " on classpath!");
        }

        try {
            Properties properties = new Properties();
            properties.load(inputStream);
            inputStream.close();
            setDnsCache(properties);
        } catch (Exception e) {
            final String message = String.format("Fail to loadDnsCacheConfig from %s, cause: %s",
                    propertiesFileName, e);
            throw new DnsCacheManipulatorException(message, e);
        }
    }
/**
     * Load dns config from the specified properties file on classpath, then set dns cache.
     *
     * @param propertiesFileName specified properties file name on classpath.
     * @throws DnsCacheManipulatorException Operation fail
     * @see DnsCacheManipulator#setDnsCache(java.util.Properties)
     */
Load dns config from the specified properties file on classpath, then set dns cache.
@param propertiesFileName specified properties file name on classpath.
Load dns config from the specified properties file on classpath then set dns cache . @param propertiesFileName specified properties file name on classpath .
public static void loadDnsCacheConfig(@Nonnull String propertiesFileName) {
        InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertiesFileName);
        if (inputStream == null) {
            inputStream = DnsCacheManipulator.class.getClassLoader().getResourceAsStream(propertiesFileName);
        }
        if (inputStream == null) {
            throw new DnsCacheManipulatorException("Fail to find " + propertiesFileName + " on classpath!");
        }
        try {
            Properties properties = new Properties();
            properties.load(inputStream);
            inputStream.close();
            setDnsCache(properties);
        } catch (Exception e) {
            final String message = String.format("Fail to loadDnsCacheConfig from %s, cause: %s",
                    propertiesFileName, e);
            throw new DnsCacheManipulatorException(message, e);
        }
    }
public static void loadDnsCacheConfig ( @ Nonnull String propertiesFileName ) { InputStream inputStream = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( propertiesFileName ) ; if ( inputStream == null ) { inputStream = DnsCacheManipulator . class . getClassLoader ( ) . getResourceAsStream ( propertiesFileName ) ; } if ( inputStream == null ) { throw new DnsCacheManipulatorException ( "Fail to find " + propertiesFileName + " on classpath!" ) ; } try { Properties properties = new Properties ( ) ; properties . load ( inputStream ) ; inputStream . close ( ) ; setDnsCache ( properties ) ; } catch ( Exception e ) { final String message = String . format ( "Fail to loadDnsCacheConfig from %s, cause: %s" , propertiesFileName , e ) ; throw new DnsCacheManipulatorException ( message , e ) ; } }
Load dns config from the specified properties file on classpath, then set dns cache.
Load dns config from the specified properties file on classpath then set dns cache .