Path: blob/master/src/java.base/share/classes/sun/net/dns/ResolverConfiguration.java
41159 views
/*1* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.net.dns;2627import java.util.List;2829/**30* The configuration of the client resolver.31*32* <p>A ResolverConfiguration is a singleton that represents the33* configuration of the client resolver. The ResolverConfiguration34* is opened by invoking the {@link #open() open} method.35*36* @since 1.437*/3839public abstract class ResolverConfiguration {4041private static final Object lock = new Object();4243private static ResolverConfiguration provider;4445protected ResolverConfiguration() { }4647/**48* Opens the resolver configuration.49*50* @return the resolver configuration51*/52public static ResolverConfiguration open() {53synchronized (lock) {54if (provider == null) {55provider = new sun.net.dns.ResolverConfigurationImpl();56}57return provider;58}59}6061/**62* Returns a list corresponding to the domain search path. The63* list is ordered by the search order used for host name lookup.64* Each element in the list returns a {@link java.lang.String}65* containing a domain name or suffix.66*67* @return list of domain names68*/69public abstract List<String> searchlist();7071/**72* Returns a list of name servers used for host name lookup.73* Each element in the list returns a {@link java.lang.String}74* containing the textual representation of the IP address of75* the name server.76*77* @return list of the name servers78*/79public abstract List<String> nameservers();808182/**83* Options representing certain resolver variables of84* a {@link ResolverConfiguration}.85*/86public abstract static class Options {8788/**89* Returns the maximum number of attempts the resolver90* will connect to each name server before giving up91* and returning an error.92*93* @return the resolver attempts value or -1 is unknown94*/95public int attempts() {96return -1;97}9899/**100* Returns the basic retransmit timeout, in milliseconds,101* used by the resolver. The resolver will typically use102* an exponential backoff algorithm where the timeout is103* doubled for every retransmit attempt. The basic104* retransmit timeout, returned here, is the initial105* timeout for the exponential backoff algorithm.106*107* @return the basic retransmit timeout value or -1108* if unknown109*/110public int retrans() {111return -1;112}113}114115/**116* Returns the {@link #Options} for the resolver.117*118* @return options for the resolver119*/120public abstract Options options();121}122123124