You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/08/13 14:51:42 UTC

[camel] branch main updated: CAMEL-18390: [camel-hyperledger-aries] Component should not maintain websocket connection(s) (#8159)

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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 03bad9d0ccc CAMEL-18390: [camel-hyperledger-aries] Component should not maintain websocket connection(s) (#8159)
03bad9d0ccc is described below

commit 03bad9d0cccea14744959cc24ff52d19116543dc
Author: Thomas Diesler <td...@redhat.com>
AuthorDate: Sat Aug 13 16:51:36 2022 +0200

    CAMEL-18390: [camel-hyperledger-aries] Component should not maintain websocket connection(s) (#8159)
---
 .../camel/component/aries/HyperledgerAriesComponent.java  | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/components/camel-hyperledger-aries/src/main/java/org/apache/camel/component/aries/HyperledgerAriesComponent.java b/components/camel-hyperledger-aries/src/main/java/org/apache/camel/component/aries/HyperledgerAriesComponent.java
index ff6f2c30256..2908dfebd0a 100644
--- a/components/camel-hyperledger-aries/src/main/java/org/apache/camel/component/aries/HyperledgerAriesComponent.java
+++ b/components/camel-hyperledger-aries/src/main/java/org/apache/camel/component/aries/HyperledgerAriesComponent.java
@@ -45,7 +45,6 @@ public class HyperledgerAriesComponent extends DefaultComponent {
     private boolean removeWalletsOnShutdown;
 
     private AriesClient adminClient;
-    private WebSocketClient adminWebSocketClient;
 
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
@@ -68,9 +67,6 @@ public class HyperledgerAriesComponent extends DefaultComponent {
 
     @Override
     protected void doShutdown() throws Exception {
-        if (adminWebSocketClient != null) {
-            adminWebSocketClient.close();
-        }
         if (removeWalletsOnShutdown) {
             for (NessusWallet wallet : walletRegistry.getWallets()) {
                 wallet.closeAndRemove();
@@ -126,12 +122,11 @@ public class HyperledgerAriesComponent extends DefaultComponent {
         return AriesClientFactory.createClient(agentConfig, wallet);
     }
 
-    public WebSocketClient adminWebSocketClient(WebSocketListener wslistener) {
-        if (adminWebSocketClient == null) {
-            adminWebSocketClient = new WebSocketClient(agentConfig, null);
-            adminWebSocketClient.openWebSocket(wslistener);
-        }
-        return adminWebSocketClient;
+    public WebSocketClient createAdminWebSocketClient(WebSocketListener wslistener) {
+        AgentConfiguration agentConfig = getAgentConfiguration();
+        WebSocketClient wsclient = new WebSocketClient(agentConfig, null);
+        wsclient.openWebSocket(wslistener);
+        return wsclient;
     }
 
     public WebSocketClient createWebSocketClient(String walletName, WebSocketListener wslistener) {