From 75fccd972cb4f09a07ba35821c94ae2a4bb34504 Mon Sep 17 00:00:00 2001 From: Santiago Pericasgeertsen Date: Wed, 24 Jan 2024 09:18:33 -0500 Subject: [PATCH] Guard logging calls and deprecate useDefaultJavaResolver() method. Signed-off-by: Santiago Pericasgeertsen --- .../helidon/webclient/api/DefaultAddressLookupFinder.java | 8 ++++++-- .../main/java/io/helidon/webclient/spi/DnsResolver.java | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/webclient/api/src/main/java/io/helidon/webclient/api/DefaultAddressLookupFinder.java b/webclient/api/src/main/java/io/helidon/webclient/api/DefaultAddressLookupFinder.java index 5f1f5942fe7..68941d93f9f 100644 --- a/webclient/api/src/main/java/io/helidon/webclient/api/DefaultAddressLookupFinder.java +++ b/webclient/api/src/main/java/io/helidon/webclient/api/DefaultAddressLookupFinder.java @@ -41,10 +41,14 @@ final class DefaultAddressLookupFinder { private static final LazyValue DEFAULT_IP_VERSION = LazyValue.create(() -> { if (IPV4_PREFERRED.get() || !IPV6_PREFERRED.get()) { - LOGGER.log(Level.DEBUG, "Preferring IPv4 over IPv6 address resolution"); + if (LOGGER.isLoggable(Level.DEBUG)) { + LOGGER.log(Level.DEBUG, "Preferring IPv4 over IPv6 address resolution"); + } return DnsAddressLookup.IPV4_PREFERRED; } - LOGGER.log(Level.DEBUG, "Preferring IPv6 over IPv4 address resolution"); + if (LOGGER.isLoggable(Level.DEBUG)) { + LOGGER.log(Level.DEBUG, "Preferring IPv6 over IPv4 address resolution"); + } return DnsAddressLookup.IPV6_PREFERRED; }); diff --git a/webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolver.java b/webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolver.java index ba376096af3..930a8df9e6f 100644 --- a/webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolver.java +++ b/webclient/api/src/main/java/io/helidon/webclient/spi/DnsResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,11 +27,13 @@ public interface DnsResolver { /** * Whether to use standard Java DNS resolver. - * If this method returns true, {@link #resolveAddress(String, io.helidon.webclient.api.DnsAddressLookup)} method is not invoked and - * no {@link DnsAddressLookup} preferences will be applied. + * If this method returns true, {@link #resolveAddress(String, io.helidon.webclient.api.DnsAddressLookup)} + * method is not invoked and no {@link DnsAddressLookup} preferences will be applied. * * @return use standard Java resolver + * @deprecated this method is no longer invoked and may be removed in the future */ + @Deprecated(forRemoval = true, since = "4.0.4") default boolean useDefaultJavaResolver() { return false; }