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

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


The following commit(s) were added to refs/heads/master by this push:
     new fe3000c62 [ISSUE 4360] Fix unSubscribeUrl cannot be null (#4361)
fe3000c62 is described below

commit fe3000c62aeb3a8fb1dd37a9cf8f931273b6ccbb
Author: Alonexc <[email protected]>
AuthorDate: Tue Aug 15 17:22:39 2023 +0800

    [ISSUE 4360] Fix unSubscribeUrl cannot be null (#4361)
    
    * fix unSubscribeUrl cannot be null
    
    * remove transient and hump naming.
---
 .../http/demo/sub/service/SubService.java          | 35 ++++++++++++++--------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git 
a/eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java
 
b/eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java
index 1b4131a21..55f540f9f 100644
--- 
a/eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java
+++ 
b/eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java
@@ -34,6 +34,7 @@ import org.apache.eventmesh.common.utils.ThreadUtils;
 import 
org.apache.eventmesh.http.demo.pub.eventmeshmessage.AsyncPublishInstance;
 import org.apache.eventmesh.util.Utils;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
@@ -52,27 +53,34 @@ import lombok.extern.slf4j.Slf4j;
 @Component
 public class SubService implements InitializingBean {
 
-    private transient EventMeshHttpConsumer eventMeshHttpConsumer;
+    private EventMeshHttpConsumer eventMeshHttpConsumer;
 
-    private transient Properties properties;
+    private Properties properties;
 
-    private final transient List<SubscriptionItem> topicList = 
Lists.newArrayList(
+    {
+        try {
+            properties = 
Utils.readPropertiesFile(ExampleConstants.CONFIG_FILE_NAME);
+        } catch (IOException e) {
+            log.error("read properties file failed", e);
+        }
+    }
+
+    final String localPort = properties.getProperty(SERVER_PORT);
+    final String testURL = getURL(localPort, "/sub/test");
+
+    private final List<SubscriptionItem> topicList = Lists.newArrayList(
         new SubscriptionItem(ExampleConstants.EVENTMESH_HTTP_ASYNC_TEST_TOPIC, 
SubscriptionMode.CLUSTERING, SubscriptionType.ASYNC)
     );
-    private transient String testURL;
 
     // CountDownLatch size is the same as messageSize in 
AsyncPublishInstance.java (Publisher)
-    private transient CountDownLatch countDownLatch = new 
CountDownLatch(AsyncPublishInstance.MESSAGE_SIZE);
+    private final CountDownLatch countDownLatch = new 
CountDownLatch(AsyncPublishInstance.MESSAGE_SIZE);
 
     @Override
-    public void afterPropertiesSet() throws Exception {
-        properties = 
Utils.readPropertiesFile(ExampleConstants.CONFIG_FILE_NAME);
-        final String localPort = properties.getProperty(SERVER_PORT);
-        final String eventmeshIP = 
properties.getProperty(ExampleConstants.EVENTMESH_IP);
-        final String eventmeshHttpPort = 
properties.getProperty(ExampleConstants.EVENTMESH_HTTP_PORT);
-        final String testURL = getURL(localPort, "/sub/test");
-
-        final String eventMeshIPPort = eventmeshIP + ":" + eventmeshHttpPort;
+    public void afterPropertiesSet() {
+        final String eventMeshIP = 
properties.getProperty(ExampleConstants.EVENTMESH_IP);
+        final String eventMeshHttpPort = 
properties.getProperty(ExampleConstants.EVENTMESH_HTTP_PORT);
+
+        final String eventMeshIPPort = eventMeshIP + ":" + eventMeshHttpPort;
         final EventMeshHttpClientConfig eventMeshClientConfig = 
EventMeshHttpClientConfig.builder()
             .liteEventMeshAddr(eventMeshIPPort)
             
.consumerGroup(ExampleConstants.DEFAULT_EVENTMESH_TEST_CONSUMER_GROUP)
@@ -92,6 +100,7 @@ public class SubService implements InitializingBean {
                 countDownLatch.await();
             } catch (InterruptedException e) {
                 log.error("interrupted exception", e);
+                Thread.currentThread().interrupt();
             }
             if (log.isInfoEnabled()) {
                 log.info("stopThread start....");


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to