Skip to content

Commit

Permalink
Fix possible race in the SimpleResolverProviderImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
mrserb committed Jun 1, 2023
1 parent 3ab7752 commit 7bb0de6
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ public InetAddressResolver get(Configuration configuration) {
public Stream<InetAddress> lookupByName(String host, LookupPolicy lookupPolicy) throws UnknownHostException {
LOGGER.info("Looking-up addresses for '" + host + "'. Lookup characteristics:" +
Integer.toString(lookupPolicy.characteristics(), 2));
LOOKUP_HISTORY.add(lookupPolicy);
LAST_LOOKUP_TIMESTAMP = System.nanoTime();
if (unreachableServer) {
throw new UnknownHostException("unreachableServer");
}
if (blocker != null) {
try {
blocker.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
LOOKUP_HISTORY.add(lookupPolicy);
LAST_LOOKUP_TIMESTAMP = System.nanoTime();
if (unreachableServer) {
throw new UnknownHostException("unreachableServer");
}
return registry.lookupHost(host, lookupPolicy);
}

Expand Down

0 comments on commit 7bb0de6

Please sign in to comment.