This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit e758875e08a353a0bf6452b4597f3783b98a8331
Author: Duncan Grant <[email protected]>
AuthorDate: Tue Jun 1 14:31:26 2021 +0100

    Remove Config change listener
    
    This was causing a memory leak as every request creates a new
    DelegatingSecurityProvider and this registers a config change listener.
    On config change the delegate security provider would then attempt a
    reload 1000s of times although only one would actually have effect and
    the rest would then use the cached delegate.
    
    This wasn't needed and the functionality remains the same - minus the
    leak of memory.
---
 .../provider/DelegatingSecurityProvider.java       | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git 
a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/security/provider/DelegatingSecurityProvider.java
 
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/security/provider/DelegatingSecurityProvider.java
index 4a9f556..0805089 100644
--- 
a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/security/provider/DelegatingSecurityProvider.java
+++ 
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/security/provider/DelegatingSecurityProvider.java
@@ -47,24 +47,9 @@ public class DelegatingSecurityProvider implements 
SecurityProvider {
 
     public DelegatingSecurityProvider(ManagementContext mgmt) {
         this.mgmt = mgmt;
-        mgmt.addPropertiesReloadListener(new PropertiesListener());
     }
     
     private SecurityProvider delegate;
-    private final AtomicLong modCount = new AtomicLong();
-
-    private class PropertiesListener implements 
ManagementContext.PropertiesReloadListener {
-        private static final long serialVersionUID = 8148722609022378917L;
-
-        @Override
-        public void reloaded() {
-            log.debug("{} reloading security provider", 
DelegatingSecurityProvider.this);
-            synchronized (DelegatingSecurityProvider.this) {
-                loadDelegate();
-                invalidateExistingSessions();
-            }
-        }
-    }
 
     public synchronized SecurityProvider getDelegate() {
         if (delegate == null) {
@@ -197,13 +182,6 @@ public class DelegatingSecurityProvider implements 
SecurityProvider {
         return (SecurityProvider) delegateO;
     }
 
-    /**
-     * Causes all existing sessions to be invalidated.
-     */
-    protected void invalidateExistingSessions() {
-        modCount.incrementAndGet();
-    }
-
     @Override
     public boolean isAuthenticated(HttpSession session) {
         return getDelegate().isAuthenticated(session);

Reply via email to