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

mikexue 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 b7563f3d2 simplify code
     new 46756a914 Merge pull request #2756 from weihubeats/StreamTopicConfig
b7563f3d2 is described below

commit b7563f3d26a7eb1090965ef95026c23cf92e4b9f
Author: weihu <[email protected]>
AuthorDate: Sat Dec 31 16:23:16 2022 +0800

    simplify code
---
 .../consumer/consumergroup/StreamTopicConfig.java    | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/consumer/consumergroup/StreamTopicConfig.java
 
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/consumer/consumergroup/StreamTopicConfig.java
index b9f3d8661..fbd4b15bd 100644
--- 
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/consumer/consumergroup/StreamTopicConfig.java
+++ 
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/consumer/consumergroup/StreamTopicConfig.java
@@ -27,11 +27,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
 
+@Slf4j
 public class StreamTopicConfig extends ConsumerGroupTopicConfig {
-    private final Logger logger = 
LoggerFactory.getLogger(StreamTopicConfig.class);
 
     /**
      * Key: IDC
@@ -54,8 +53,8 @@ public class StreamTopicConfig extends 
ConsumerGroupTopicConfig {
     @Override
     public synchronized void registerClient(ConsumerGroupClient client) {
         if (!client.getGrpcType().equals(grpcType)) {
-            logger.warn("Invalid grpc type: {}, expecting grpc type: {}, can 
not register client {}",
-                client.getGrpcType(), grpcType, client.toString());
+            log.warn("Invalid grpc type: {}, expecting grpc type: {}, can not 
register client {}",
+                client.getGrpcType(), grpcType, client);
             return;
         }
         String idc = client.getIdc();
@@ -80,7 +79,7 @@ public class StreamTopicConfig extends 
ConsumerGroupTopicConfig {
             return;
         }
         emitters.remove(clientIp + ":" + clientPid);
-        if (emitters.size() == 0) {
+        if (emitters.isEmpty()) {
             idcEmitterMap.remove(idc);
         }
         idcEmitters = buildIdcEmitter();
@@ -125,10 +124,11 @@ public class StreamTopicConfig extends 
ConsumerGroupTopicConfig {
 
     private Map<String, List<EventEmitter<SimpleMessage>>> buildIdcEmitter() {
         Map<String, List<EventEmitter<SimpleMessage>>> result = new 
HashMap<>();
-        for (Map.Entry<String, Map<String, EventEmitter<SimpleMessage>>> entry 
: idcEmitterMap.entrySet()) {
-            List<EventEmitter<SimpleMessage>> emitterList = new 
LinkedList<>(entry.getValue().values());
-            result.put(entry.getKey(), emitterList);
-        }
+        idcEmitterMap.forEach((k, v) -> {
+            List<EventEmitter<SimpleMessage>> emitterList = new 
LinkedList<>(v.values());
+            result.put(k, emitterList);
+
+        });
         return result;
     }
 


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

Reply via email to