2
|
1 |
/*
|
6112
|
2 |
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5506
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
package sun.net.dns;
|
|
27 |
|
|
28 |
import java.util.List;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* The configuration of the client resolver.
|
|
32 |
*
|
|
33 |
* <p>A ResolverConfiguration is a singleton that represents the
|
|
34 |
* configuration of the client resolver. The ResolverConfiguration
|
|
35 |
* is opened by invoking the {@link #open() open} method.
|
|
36 |
*
|
|
37 |
* @since 1.4
|
|
38 |
*/
|
|
39 |
|
|
40 |
public abstract class ResolverConfiguration {
|
|
41 |
|
|
42 |
private static final Object lock = new Object();
|
|
43 |
|
|
44 |
private static ResolverConfiguration provider;
|
|
45 |
|
|
46 |
protected ResolverConfiguration() { }
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Opens the resolver configuration.
|
|
50 |
*
|
|
51 |
* @return the resolver configuration
|
|
52 |
*/
|
|
53 |
public static ResolverConfiguration open() {
|
|
54 |
synchronized (lock) {
|
|
55 |
if (provider == null) {
|
|
56 |
provider = new sun.net.dns.ResolverConfigurationImpl();
|
|
57 |
}
|
|
58 |
return provider;
|
|
59 |
}
|
|
60 |
}
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Returns a list corresponding to the domain search path. The
|
|
64 |
* list is ordered by the search order used for host name lookup.
|
|
65 |
* Each element in the list returns a {@link java.lang.String}
|
|
66 |
* containing a domain name or suffix.
|
|
67 |
*
|
|
68 |
* @return list of domain names
|
|
69 |
*/
|
6112
|
70 |
public abstract List<String> searchlist();
|
2
|
71 |
|
|
72 |
/**
|
|
73 |
* Returns a list of name servers used for host name lookup.
|
|
74 |
* Each element in the list returns a {@link java.lang.String}
|
|
75 |
* containing the textual representation of the IP address of
|
|
76 |
* the name server.
|
|
77 |
*
|
|
78 |
* @return list of the name servers
|
|
79 |
*/
|
6112
|
80 |
public abstract List<String> nameservers();
|
2
|
81 |
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Options representing certain resolver variables of
|
|
85 |
* a {@link ResolverConfiguration}.
|
|
86 |
*/
|
|
87 |
public static abstract class Options {
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Returns the maximum number of attempts the resolver
|
|
91 |
* will connect to each name server before giving up
|
|
92 |
* and returning an error.
|
|
93 |
*
|
|
94 |
* @return the resolver attempts value or -1 is unknown
|
|
95 |
*/
|
|
96 |
public int attempts() {
|
|
97 |
return -1;
|
|
98 |
}
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns the basic retransmit timeout, in milliseconds,
|
|
102 |
* used by the resolver. The resolver will typically use
|
|
103 |
* an exponential backoff algorithm where the timeout is
|
|
104 |
* doubled for every retransmit attempt. The basic
|
|
105 |
* retransmit timeout, returned here, is the initial
|
|
106 |
* timeout for the exponential backoff algorithm.
|
|
107 |
*
|
|
108 |
* @return the basic retransmit timeout value or -1
|
|
109 |
* if unknown
|
|
110 |
*/
|
|
111 |
public int retrans() {
|
|
112 |
return -1;
|
|
113 |
}
|
|
114 |
}
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Returns the {@link #Options} for the resolver.
|
|
118 |
*
|
|
119 |
* @return options for the resolver
|
|
120 |
*/
|
|
121 |
public abstract Options options();
|
|
122 |
}
|