From 5b7d2747236415340741c32e74a77c977251a3b7 Mon Sep 17 00:00:00 2001 From: John Blum Date: Thu, 31 May 2018 12:57:24 -0700 Subject: [PATCH] Implement o.s.beans.factory.DisposableBean. --- .../geode/security/support/SecurityManagerProxy.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/geode-spring-boot/src/main/java/org/springframework/geode/security/support/SecurityManagerProxy.java b/geode-spring-boot/src/main/java/org/springframework/geode/security/support/SecurityManagerProxy.java index 928bc96a..fb9e13cd 100644 --- a/geode-spring-boot/src/main/java/org/springframework/geode/security/support/SecurityManagerProxy.java +++ b/geode-spring-boot/src/main/java/org/springframework/geode/security/support/SecurityManagerProxy.java @@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicReference; import org.apache.geode.security.AuthenticationFailedException; import org.apache.geode.security.ResourcePermission; +import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.gemfire.support.LazyWiringDeclarableSupport; import org.springframework.util.Assert; @@ -69,7 +70,7 @@ import org.springframework.util.Assert; */ @SuppressWarnings("unused") public class SecurityManagerProxy extends LazyWiringDeclarableSupport - implements org.apache.geode.security.SecurityManager { + implements org.apache.geode.security.SecurityManager, DisposableBean { private static final AtomicReference INSTANCE = new AtomicReference<>(); @@ -87,7 +88,6 @@ public class SecurityManagerProxy extends LazyWiringDeclarableSupport .orElseThrow(() -> newIllegalStateException("SecurityManagerProxy was not configured")); } - /** * Constructs a new instance of {@link SecurityManagerProxy}, which will delegate all Apache Geode * security operations to a Spring managed {@link org.apache.geode.security.SecurityManager} bean. @@ -154,4 +154,10 @@ public class SecurityManagerProxy extends LazyWiringDeclarableSupport public void close() { getSecurityManager().close(); } + + @Override + public void destroy() throws Exception { + super.destroy(); + INSTANCE.set(null); + } }