You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by am...@apache.org on 2026/06/04 19:51:16 UTC
(aries-rsa) branch master updated (3fc439ad -> 2858b5ff)
This is an automated email from the ASF dual-hosted git repository.
amichair pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/aries-rsa.git
from 3fc439ad Bump net.bytebuddy:byte-buddy from 1.18.9 to 1.18.10 (#137)
new 7bcc3325 Improve TCP Discovery logs
new 2858b5ff ARIES-2232 Fix TCP Discovery InterestManager not notifying listeners when scope changes
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/aries/rsa/discovery/tcp/InterestManager.java | 14 +++++++++-----
.../aries/rsa/discovery/tcp/TcpConnectionManager.java | 14 +++++++++++---
.../org/apache/aries/rsa/discovery/tcp/TcpMessage.java | 16 ++++++++++++++++
.../topologymanager/exporter/TopologyManagerExport.java | 3 +++
4 files changed, 39 insertions(+), 8 deletions(-)
(aries-rsa) 02/02: ARIES-2232 Fix TCP Discovery InterestManager not notifying listeners when scope changes
Posted by am...@apache.org.
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 2858b5ffefe2f544141efb5ac93061ee94cba8c0
Author: Amichai Rothman <am...@apache.org>
AuthorDate: Wed Jun 3 20:02:37 2026 +0300
ARIES-2232 Fix TCP Discovery InterestManager not notifying listeners when scope changes
---
.../org/apache/aries/rsa/discovery/tcp/InterestManager.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/InterestManager.java b/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/InterestManager.java
index 6c9c0365..5abdfc75 100644
--- a/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/InterestManager.java
+++ b/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/InterestManager.java
@@ -48,13 +48,13 @@ public class InterestManager {
// an existing listener is not notified, but we do need to update its scopes (interest)
Interest interest = new Interest(sref, listener);
interests.put(sref, interest); // if it already exists - replace it with the new interest (scopes)
- LOG.trace("Updated interest {} (new={})", interest, isNew);
- if (isNew) {
- // notify new listener of all known remote endpoints
- remoteEndpoints.values().stream()
- .flatMap(endpoints -> endpoints.values().stream())
+ LOG.trace("Updated interest {} (new={})", isNew, interest);
+ // notify new or updated listener of all known remote endpoints
+ // (according to the spec, the listener is idempotent so we don't worry about ADDED duplicates)
+ LOG.debug("Notifying new interest {} of all known remote endpoints {}", interest, remoteEndpoints.values());
+ remoteEndpoints.values().stream()
+ .flatMap(endpoints -> endpoints.values().stream())
.forEach(endpoint -> interest.notifyListener(new EndpointEvent(ADDED, endpoint)));
- }
}
public void removeListener(ServiceReference<EndpointEventListener> sref) {
(aries-rsa) 01/02: Improve TCP Discovery logs
Posted by am...@apache.org.
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 7bcc33255c4b35c7f6d65a887c59920e2cda5e9d
Author: Amichai Rothman <am...@apache.org>
AuthorDate: Wed Jun 3 19:56:11 2026 +0300
Improve TCP Discovery logs
---
.../apache/aries/rsa/discovery/tcp/InterestManager.java | 4 ++++
.../aries/rsa/discovery/tcp/TcpConnectionManager.java | 14 +++++++++++---
.../org/apache/aries/rsa/discovery/tcp/TcpMessage.java | 16 ++++++++++++++++
.../topologymanager/exporter/TopologyManagerExport.java | 3 +++
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/InterestManager.java b/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/InterestManager.java
index 4f9c2829..6c9c0365 100644
--- a/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/InterestManager.java
+++ b/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/InterestManager.java
@@ -22,6 +22,8 @@ import org.osgi.framework.ServiceReference;
import org.osgi.service.remoteserviceadmin.EndpointDescription;
import org.osgi.service.remoteserviceadmin.EndpointEvent;
import org.osgi.service.remoteserviceadmin.EndpointEventListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -34,6 +36,7 @@ import static org.osgi.service.remoteserviceadmin.EndpointEvent.*;
* the former about the latter.
*/
public class InterestManager {
+ private static final Logger LOG = LoggerFactory.getLogger(InterestManager.class);
// listener to its interest
private final Map<ServiceReference<EndpointEventListener>, Interest> interests = new ConcurrentHashMap<>();
// peer framework UUID to endpointId to endpoint
@@ -45,6 +48,7 @@ public class InterestManager {
// an existing listener is not notified, but we do need to update its scopes (interest)
Interest interest = new Interest(sref, listener);
interests.put(sref, interest); // if it already exists - replace it with the new interest (scopes)
+ LOG.trace("Updated interest {} (new={})", interest, isNew);
if (isNew) {
// notify new listener of all known remote endpoints
remoteEndpoints.values().stream()
diff --git a/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/TcpConnectionManager.java b/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/TcpConnectionManager.java
index 8b635327..ce928a26 100644
--- a/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/TcpConnectionManager.java
+++ b/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/TcpConnectionManager.java
@@ -74,6 +74,7 @@ public class TcpConnectionManager implements EndpointEventListener {
}
public void open(String bindAddress, int port, Collection<String> peers) throws IOException {
+ LOG.info("opening server socket at {}:{}", bindAddress, port);
serverSocket = new ServerSocket();
serverSocket.setReuseAddress(true);
serverSocket.bind(new InetSocketAddress(bindAddress, port));
@@ -82,6 +83,7 @@ public class TcpConnectionManager implements EndpointEventListener {
}
public void close() throws IOException {
+ LOG.info("closing connection manager");
closing = true;
serverSocket.close(); // acceptLoop will get SocketException
connections.forEach(TcpConnection::close);
@@ -93,7 +95,7 @@ public class TcpConnectionManager implements EndpointEventListener {
.filter(peer -> !this.peers.contains(peer)) // only new ones
.filter(peer -> !localAddress.equals(peer)) // exclude ourself
.forEach(peer -> {
- LOG.info("Adding peer {}", peer);
+ LOG.info("adding peer {}", peer);
this.peers.add(peer);
executor.submit(() -> connectLoop(peer));
});
@@ -113,7 +115,7 @@ public class TcpConnectionManager implements EndpointEventListener {
} catch (IOException ioe) {
return; // socket closed
} catch (Throwable t) {
- LOG.error("Unexpected error in accept loop - shutting down", t);
+ LOG.error("unexpected error in accept loop - shutting down", t);
return;
}
}
@@ -127,7 +129,7 @@ public class TcpConnectionManager implements EndpointEventListener {
onConnected(socket, address);
return; // connection established; onConnectionClosed will restart this loop if needed
} catch (IOException ioe) {
- LOG.debug("error connecting to {}, will retry soon", uri, ioe);
+ LOG.debug("error connecting to {}, will retry in {} ms", uri, reconnectDelay, ioe);
try {
Thread.sleep(reconnectDelay);
} catch (InterruptedException ie) {
@@ -142,8 +144,11 @@ public class TcpConnectionManager implements EndpointEventListener {
}
private void onConnected(Socket socket, String address) throws IOException {
+ LOG.debug("established connection with {} ({})", socket.getRemoteSocketAddress(),
+ address == null ? "incoming" : address);
try {
TcpConnection conn = new TcpConnection(socket, address, this::onMessage, this::onClosed);
+ LOG.debug("connection created: {}", conn);
connections.add(conn);
conn.send(new HandshakeMessage(localUuid, localAddress, new ArrayList<>(peers)));
// don't send known endpoints yet, only after receiving handshake
@@ -158,6 +163,7 @@ public class TcpConnectionManager implements EndpointEventListener {
}
public void onClosed(TcpConnection conn) {
+ LOG.debug("connection closed: {}", conn);
connections.remove(conn);
String peerUuid = conn.getPeerUuid();
if (peerUuid != null) { // passed the handshake
@@ -176,6 +182,7 @@ public class TcpConnectionManager implements EndpointEventListener {
}
private void onMessage(TcpConnection conn, TcpMessage message) {
+ LOG.debug("received message {} on connection {}", message, conn);
if (message instanceof HandshakeMessage) {
HandshakeMessage h = (HandshakeMessage) message;
// update the peer data
@@ -200,6 +207,7 @@ public class TcpConnectionManager implements EndpointEventListener {
// keep retrying to connect. to solve this, only the outbound peer is the one
// that closes the connection. The inbound side just doesn't use it until then.
if (conn.isOutbound()) {
+ LOG.debug("connection already exists with peer {}, closing {}", h.getUuid(), conn);
conn.close();
}
return;
diff --git a/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/TcpMessage.java b/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/TcpMessage.java
index 093a941b..2739110d 100644
--- a/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/TcpMessage.java
+++ b/discovery/tcp/src/main/java/org/apache/aries/rsa/discovery/tcp/TcpMessage.java
@@ -50,6 +50,12 @@ public class TcpMessage implements Serializable {
public List<String> getPeers() {
return peers;
}
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[uuid=" + uuid + ", address=" + address + ", peers=" + peers + "]";
+ }
+
}
// there is no distinction between add and update, since it's
@@ -65,6 +71,11 @@ public class TcpMessage implements Serializable {
public Map<String, Object> getProperties() {
return properties;
}
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[properties=" + properties + "]";
+ }
}
public static class RemoveMessage extends TcpMessage {
@@ -78,5 +89,10 @@ public class TcpMessage implements Serializable {
public String getEndpointId() {
return endpointId;
}
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[endpointId=" + endpointId + "]";
+ }
}
}
diff --git a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExport.java b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExport.java
index 4baf626e..751de5f7 100644
--- a/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExport.java
+++ b/topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExport.java
@@ -144,6 +144,9 @@ public class TopologyManagerExport implements ServiceListener {
LOG.debug("exporting Service {} using RemoteServiceAdmin {}", sref, rsa.getClass().getName());
Map<String, ?> addProps = policy.additionalParameters(sref);
Collection<ExportRegistration> regs = rsa.exportService(sref, addProps);
+ if (regs.isEmpty()) {
+ LOG.warn("no supported configs found for exporting service {}", sref);
+ }
// process successful/failed registrations
for (ExportRegistration reg : regs) {