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
The following commit(s) were added to refs/heads/master by this push:
new a6adf50a ARIES-2238 Fix LocalEndpointManager should remove endpoints
only when bundle is stopped
a6adf50a is described below
commit a6adf50a87a19dc9b763ad652889900b3e367994
Author: Amichai Rothman <[email protected]>
AuthorDate: Wed Jun 17 13:07:58 2026 +0300
ARIES-2238 Fix LocalEndpointManager should remove endpoints only when
bundle is stopped
---
.../aries/rsa/spi/discovery/LocalEndpointManager.java | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git
a/spi/src/main/java/org/apache/aries/rsa/spi/discovery/LocalEndpointManager.java
b/spi/src/main/java/org/apache/aries/rsa/spi/discovery/LocalEndpointManager.java
index b9f4d6ae..866c00c9 100644
---
a/spi/src/main/java/org/apache/aries/rsa/spi/discovery/LocalEndpointManager.java
+++
b/spi/src/main/java/org/apache/aries/rsa/spi/discovery/LocalEndpointManager.java
@@ -125,7 +125,7 @@ public class LocalEndpointManager {
@Override
public EndpointEventListener getService(Bundle bundle,
ServiceRegistration<EndpointEventListener> registration) {
long bundleId = bundle.getBundleId();
- LOG.debug("service factory getting EndpointEventListener for
bundle {} ({})",
+ LOG.trace("service factory getting EndpointEventListener for
bundle {} ({})",
bundleId, bundle.getSymbolicName());
return ((event, filter) -> endpointChanged(event, filter,
bundleId));
}
@@ -133,11 +133,15 @@ public class LocalEndpointManager {
@Override
public void ungetService(Bundle bundle,
ServiceRegistration<EndpointEventListener> registration, EndpointEventListener
service) {
long bundleId = bundle.getBundleId();
- LOG.debug("service factory ungetting EndpointEventListener for
bundle {} ({})",
- bundleId, bundle.getSymbolicName());
- localEndpoints.values().stream()
- .filter(eb -> eb.bundleIds.contains(bundleId))
- .forEach(eb -> endpointChanged(new
EndpointEvent(EndpointEvent.REMOVED, eb.endpoint), "", bundleId));
+ LOG.trace("service factory ungetting EndpointEventListener for
bundle {} ({}) state {}",
+ bundleId, bundle.getSymbolicName(), bundle.getState());
+ if (bundle.getState() == Bundle.STOPPING) {
+ LOG.debug("bundle {} is stopping ({}), removing all of its
endpoints",
+ bundleId, bundle.getSymbolicName());
+ localEndpoints.values().stream()
+ .filter(eb -> eb.bundleIds.contains(bundleId))
+ .forEach(eb -> endpointChanged(new
EndpointEvent(EndpointEvent.REMOVED, eb.endpoint), "", bundleId));
+ }
}
}