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

io.lettuce.core.resource.DnsResolvers Maven / Gradle / Ivy

Go to download

Advanced and thread-safe Java Redis client for synchronous, asynchronous, and reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs and much more.

The newest version!
package io.lettuce.core.resource;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * Predefined DNS resolvers.
 *
 * @author Mark Paluch
 * @since 4.2
 */
public enum DnsResolvers implements DnsResolver {

    /**
     * Java VM default resolver.
     */
    JVM_DEFAULT {

        @Override
        public InetAddress[] resolve(String host) throws UnknownHostException {
            return InetAddress.getAllByName(host);
        }

    },

    /**
     * Non-resolving {@link DnsResolver}. Returns an empty {@link InetAddress} to indicate an unresolved address.
     *
     * @see java.net.InetSocketAddress#createUnresolved(String, int)
     * @since 4.4
     */
    UNRESOLVED {

        @Override
        public InetAddress[] resolve(String host) throws UnknownHostException {
            return new InetAddress[0];
        }

    };

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy