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

amichair pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-rsa.git

commit aedb3c9dbf535982cb018af04aed22b32e806284
Author: Amichai Rothman <[email protected]>
AuthorDate: Mon Mar 30 12:38:58 2026 +0300

    Fix EndpointListenerManager not unregistering hooks when stopped
---
 .../importer/local/EndpointListenerManager.java              | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerManager.java
 
b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerManager.java
index 03cfcfdf..751e317f 100644
--- 
a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerManager.java
+++ 
b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/importer/local/EndpointListenerManager.java
@@ -46,6 +46,8 @@ public class EndpointListenerManager implements 
ServiceInterestListener {
 
     private final BundleContext bctx;
     private volatile ServiceRegistration<?> serviceRegistration;
+    private volatile ServiceRegistration<?> listenerHookeRegistration;
+    private volatile ServiceRegistration<?> findHookRegistration;
 
     private final List<String> filters = new ArrayList<>();
     private final EndpointEventListener endpointListener;
@@ -67,14 +69,20 @@ public class EndpointListenerManager implements 
ServiceInterestListener {
     public void start() {
         String[] ifAr = { EndpointEventListener.class.getName() };
         serviceRegistration = bctx.registerService(ifAr, endpointListener, 
getEELProperties());
-        bctx.registerService(ListenerHook.class, listenerHook, null);
-        bctx.registerService(FindHook.class, findHook, null);
+        listenerHookeRegistration = bctx.registerService(ListenerHook.class, 
listenerHook, null);
+        findHookRegistration = bctx.registerService(FindHook.class, findHook, 
null);
     }
 
     public void stop() {
         if (serviceRegistration != null) {
             serviceRegistration.unregister();
         }
+        if (listenerHookeRegistration != null) {
+            listenerHookeRegistration.unregister();
+        }
+        if (findHookRegistration != null) {
+            findHookRegistration.unregister();
+        }
     }
 
     protected void extendScope(String filter) {

Reply via email to