Commit 98f7004
refactor(client-routes): replace CachingDnsResolver with FallbackDnsResolver
The JVM (Java 8+) already caches DNS lookups internally (~30s TTL), making the
500ms TTL layer in CachingDnsResolver redundant — the JVM's cache always wins.
The semaphore storm-prevention machinery is similarly superfluous since the JVM
serializes concurrent lookups to the same hostname internally.
The only genuine value-add is the last-known-good fallback: returning a stale IP
when DNS temporarily fails.
Remove CachingDnsResolver (TTL cache, CacheEntry, SemaphoreEntry, semaphore
logic, cacheDurationMillis constructor arg). Replace with FallbackDnsResolver
that delegates directly to InetAddress.getByName() and keeps a lastKnownGood map.
Remove dnsCacheDurationMillis from ClientRoutesConfig (field, getter,
withDnsCacheDuration() builder method, DEFAULT_DNS_CACHE_DURATION_MILLIS).
Update ClientRoutesTopologyMonitor to use new FallbackDnsResolver().
Replace CachingDnsResolverTest with FallbackDnsResolverTest; delete TTL and
semaphore tests, keep fallback, evict, and clearCache coverage.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent a1c5c91 commit 98f7004
9 files changed
Lines changed: 282 additions & 605 deletions
File tree
- core/src
- main/java/com/datastax/oss/driver
- api/core/config
- internal/core
- clientroutes
- metadata
- test/java/com/datastax/oss/driver
- api/core/config
- internal/core
- clientroutes
- metadata
Lines changed: 4 additions & 53 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
| |||
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
64 | | - | |
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
68 | | - | |
69 | 66 | | |
70 | | - | |
71 | | - | |
| 67 | + | |
72 | 68 | | |
73 | 69 | | |
74 | 70 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | 71 | | |
79 | 72 | | |
80 | | - | |
81 | 73 | | |
82 | 74 | | |
83 | 75 | | |
| |||
100 | 92 | | |
101 | 93 | | |
102 | 94 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | 95 | | |
117 | 96 | | |
118 | 97 | | |
| |||
132 | 111 | | |
133 | 112 | | |
134 | 113 | | |
135 | | - | |
136 | | - | |
137 | | - | |
| 114 | + | |
138 | 115 | | |
139 | 116 | | |
140 | 117 | | |
141 | 118 | | |
142 | | - | |
| 119 | + | |
143 | 120 | | |
144 | 121 | | |
145 | 122 | | |
| |||
150 | 127 | | |
151 | 128 | | |
152 | 129 | | |
153 | | - | |
154 | | - | |
155 | 130 | | |
156 | 131 | | |
157 | 132 | | |
158 | 133 | | |
159 | 134 | | |
160 | 135 | | |
161 | 136 | | |
162 | | - | |
163 | 137 | | |
164 | 138 | | |
165 | 139 | | |
| |||
208 | 182 | | |
209 | 183 | | |
210 | 184 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | 185 | | |
235 | 186 | | |
236 | 187 | | |
| |||
239 | 190 | | |
240 | 191 | | |
241 | 192 | | |
242 | | - | |
| 193 | + | |
243 | 194 | | |
244 | 195 | | |
245 | 196 | | |
Lines changed: 0 additions & 198 deletions
This file was deleted.
Lines changed: 10 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 41 | + | |
43 | 42 | | |
44 | | - | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
49 | | - | |
50 | | - | |
| 47 | + | |
| 48 | + | |
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
| |||
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
68 | | - | |
69 | | - | |
| 66 | + | |
70 | 67 | | |
71 | 68 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 69 | + | |
77 | 70 | | |
78 | 71 | | |
79 | 72 | | |
0 commit comments