You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by jo...@apache.org on 2022/12/07 13:47:42 UTC

[incubator-eventmesh] branch master updated: add synchronized bracket in CloudEventTCPSubClient.java (#2481)

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

jonyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 895ea35f9 add synchronized bracket in CloudEventTCPSubClient.java (#2481)
895ea35f9 is described below

commit 895ea35f9a31b43d9066480f06748fe92ae70a8c
Author: MajorHe1 <53...@users.noreply.github.com>
AuthorDate: Wed Dec 7 21:47:35 2022 +0800

    add synchronized bracket in CloudEventTCPSubClient.java (#2481)
---
 .../client/tcp/impl/cloudevent/CloudEventTCPSubClient.java        | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/cloudevent/CloudEventTCPSubClient.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/cloudevent/CloudEventTCPSubClient.java
index f6eee73e0..14f5ea4cc 100644
--- a/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/cloudevent/CloudEventTCPSubClient.java
+++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/impl/cloudevent/CloudEventTCPSubClient.java
@@ -81,9 +81,11 @@ class CloudEventTCPSubClient extends TcpClient implements EventMeshTCPSubClient<
             super.reconnect();
             hello();
             if (!CollectionUtils.isEmpty(subscriptionItems)) {
-                for (SubscriptionItem item : subscriptionItems) {
-                    Package request = MessageUtils.subscribe(item.getTopic(), item.getMode(), item.getType());
-                    this.io(request, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
+                synchronized (subscriptionItems) {
+                    for (SubscriptionItem item : subscriptionItems) {
+                        Package request = MessageUtils.subscribe(item.getTopic(), item.getMode(), item.getType());
+                        this.io(request, EventMeshCommon.DEFAULT_TIME_OUT_MILLS);
+                    }
                 }
             }
             listen();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org