equal
deleted
inserted
replaced
34 */ |
34 */ |
35 |
35 |
36 public class ResolverConfigurationImpl |
36 public class ResolverConfigurationImpl |
37 extends ResolverConfiguration |
37 extends ResolverConfiguration |
38 { |
38 { |
39 // Lock helds whilst loading configuration or checking |
39 // Lock held whilst loading configuration or checking |
40 private static Object lock = new Object(); |
40 private static Object lock = new Object(); |
41 |
41 |
42 // Resolver options |
42 // Resolver options |
43 private final Options opts; |
43 private final Options opts; |
44 |
44 |
45 // Addreses have changed |
45 // Addresses have changed |
46 private static boolean changed = false; |
46 private static boolean changed = false; |
47 |
47 |
48 // Time of last refresh. |
48 // Time of last refresh. |
49 private static long lastRefresh = -1; |
49 private static long lastRefresh = -1; |
50 |
50 |
63 // Parse string that consists of token delimited by space or commas |
63 // Parse string that consists of token delimited by space or commas |
64 // and return LinkedHashMap |
64 // and return LinkedHashMap |
65 private LinkedList<String> stringToList(String str) { |
65 private LinkedList<String> stringToList(String str) { |
66 LinkedList<String> ll = new LinkedList<>(); |
66 LinkedList<String> ll = new LinkedList<>(); |
67 |
67 |
68 // comma and space are valid delimites |
68 // comma and space are valid delimiters |
69 StringTokenizer st = new StringTokenizer(str, ", "); |
69 StringTokenizer st = new StringTokenizer(str, ", "); |
70 while (st.hasMoreTokens()) { |
70 while (st.hasMoreTokens()) { |
71 String s = st.nextToken(); |
71 String s = st.nextToken(); |
72 if (!ll.contains(s)) { |
72 if (!ll.contains(s)) { |
73 ll.add(s); |
73 ll.add(s); |
79 // Load DNS configuration from OS |
79 // Load DNS configuration from OS |
80 |
80 |
81 private void loadConfig() { |
81 private void loadConfig() { |
82 assert Thread.holdsLock(lock); |
82 assert Thread.holdsLock(lock); |
83 |
83 |
84 // if address have changed then DNS probably changed aswell; |
84 // if address have changed then DNS probably changed as well; |
85 // otherwise check if cached settings have expired. |
85 // otherwise check if cached settings have expired. |
86 // |
86 // |
87 if (changed) { |
87 if (changed) { |
88 changed = false; |
88 changed = false; |
89 } else { |
89 } else { |