From de7f28e6d9fd8f90a0f1fec2a4364032679d74f2 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Fri, 2 Feb 2018 11:39:21 -0800 Subject: [PATCH] Fix some unemitted alerts in druid-basic-security. (#5327) --- ...CoordinatorPollingBasicAuthenticatorCacheManager.java | 9 +++++---- .../CoordinatorPollingBasicAuthorizerCacheManager.java | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/cache/CoordinatorPollingBasicAuthenticatorCacheManager.java b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/cache/CoordinatorPollingBasicAuthenticatorCacheManager.java index c48f885b4cb..c7d6cad4d0f 100644 --- a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/cache/CoordinatorPollingBasicAuthenticatorCacheManager.java +++ b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/cache/CoordinatorPollingBasicAuthenticatorCacheManager.java @@ -24,8 +24,6 @@ import com.google.common.base.Preconditions; import com.google.common.io.Files; import com.google.inject.Inject; import com.google.inject.Injector; -import io.druid.java.util.emitter.EmittingLogger; -import io.druid.java.util.http.client.Request; import io.druid.client.coordinator.Coordinator; import io.druid.concurrent.LifecycleLock; import io.druid.discovery.DruidLeaderClient; @@ -38,6 +36,8 @@ import io.druid.java.util.common.concurrent.Execs; import io.druid.java.util.common.concurrent.ScheduledExecutors; import io.druid.java.util.common.lifecycle.LifecycleStart; import io.druid.java.util.common.lifecycle.LifecycleStop; +import io.druid.java.util.emitter.EmittingLogger; +import io.druid.java.util.http.client.Request; import io.druid.security.basic.BasicAuthCommonCacheConfig; import io.druid.security.basic.BasicAuthUtils; import io.druid.security.basic.authentication.BasicHTTPAuthenticator; @@ -195,7 +195,7 @@ public class CoordinatorPollingBasicAuthenticatorCacheManager implements BasicAu ); } catch (Exception e) { - LOG.makeAlert(e, "Encountered exception while fetching user map for authenticator [%s]", prefix); + LOG.makeAlert(e, "Encountered exception while fetching user map for authenticator [%s]", prefix).emit(); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { @@ -204,7 +204,8 @@ public class CoordinatorPollingBasicAuthenticatorCacheManager implements BasicAu } catch (Exception e2) { e2.addSuppressed(e); - LOG.makeAlert(e2, "Encountered exception while loading user map snapshot for authenticator [%s]", prefix); + LOG.makeAlert(e2, "Encountered exception while loading user map snapshot for authenticator [%s]", prefix) + .emit(); } } } diff --git a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/cache/CoordinatorPollingBasicAuthorizerCacheManager.java b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/cache/CoordinatorPollingBasicAuthorizerCacheManager.java index 999b569986a..6cb8c05c033 100644 --- a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/cache/CoordinatorPollingBasicAuthorizerCacheManager.java +++ b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/cache/CoordinatorPollingBasicAuthorizerCacheManager.java @@ -24,8 +24,6 @@ import com.google.common.base.Preconditions; import com.google.common.io.Files; import com.google.inject.Inject; import com.google.inject.Injector; -import io.druid.java.util.emitter.EmittingLogger; -import io.druid.java.util.http.client.Request; import io.druid.client.coordinator.Coordinator; import io.druid.concurrent.LifecycleLock; import io.druid.discovery.DruidLeaderClient; @@ -38,6 +36,8 @@ import io.druid.java.util.common.concurrent.Execs; import io.druid.java.util.common.concurrent.ScheduledExecutors; import io.druid.java.util.common.lifecycle.LifecycleStart; import io.druid.java.util.common.lifecycle.LifecycleStop; +import io.druid.java.util.emitter.EmittingLogger; +import io.druid.java.util.http.client.Request; import io.druid.security.basic.BasicAuthCommonCacheConfig; import io.druid.security.basic.BasicAuthUtils; import io.druid.security.basic.authentication.BytesFullResponseHandler; @@ -228,7 +228,7 @@ public class CoordinatorPollingBasicAuthorizerCacheManager implements BasicAutho ); } catch (Exception e) { - LOG.makeAlert(e, "Encountered exception while fetching user and role map for authorizer [%s]", prefix); + LOG.makeAlert(e, "Encountered exception while fetching user and role map for authorizer [%s]", prefix).emit(); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { @@ -237,7 +237,8 @@ public class CoordinatorPollingBasicAuthorizerCacheManager implements BasicAutho } catch (Exception e2) { e2.addSuppressed(e); - LOG.makeAlert(e2, "Encountered exception while loading user-role map snapshot for authorizer [%s]", prefix); + LOG.makeAlert(e2, "Encountered exception while loading user-role map snapshot for authorizer [%s]", prefix) + .emit(); } } }