Skip to content

Commit ffb6f99

Browse files
authored
Merge pull request #1684 from virtualcell/client-dns-negative-cache
Don't cache failed DNS lookups in the desktop client
2 parents 210bb01 + d3004aa commit ffb6f99

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

vcell-client/src/main/java/cbit/vcell/client/VCellClientMain.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ private VCellClientMain() {
8080
* @param args an array of command-line arguments
8181
*/
8282
public static void main(java.lang.String[] args) {
83+
// Recover gracefully when DNS lookups fail transiently (e.g. laptop wake from sleep).
84+
// Java's default 10s negative-result cache combined with our continuous polling loop
85+
// wedges the client at "connecting…" until restart, because the polling interval is
86+
// shorter than the cache TTL so the cached failure never expires. A short positive
87+
// TTL still gives reasonable cache locality without holding stale entries indefinitely.
88+
java.security.Security.setProperty("networkaddress.cache.ttl", "30");
89+
java.security.Security.setProperty("networkaddress.cache.negative.ttl", "0");
90+
8391
System.out.println("starting with arguments " + Arrays.asList(args));
8492
int exitCode = 1;
8593
try {

0 commit comments

Comments
 (0)