Pil0tXia commented on code in PR #4462:
URL: https://github.com/apache/eventmesh/pull/4462#discussion_r1335791671
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/consumer/consumergroup/StreamTopicConfig.java:
##########
@@ -40,19 +40,23 @@ public class StreamTopicConfig extends
ConsumerGroupTopicConfig {
/**
* Key: IDC Value: list of emitters with Client_IP:port
*/
- private final transient Map<String, Map<String, EventEmitter<CloudEvent>>>
idcEmitterMap = new ConcurrentHashMap<>();
+ private final Map<String, Map<String, EventEmitter<CloudEvent>>>
idcEmitterMap = new ConcurrentHashMap<>();
/**
* Key: IDC Value: list of emitters
*/
- private transient Map<String, List<EventEmitter<CloudEvent>>> idcEmitters
= new ConcurrentHashMap<>();
+ private Map<String, List<EventEmitter<CloudEvent>>> idcEmitters = new
ConcurrentHashMap<>();
- private transient List<EventEmitter<CloudEvent>> totalEmitters = new
ArrayList<>();
+ private List<EventEmitter<CloudEvent>> totalEmitters = new ArrayList<>();
public StreamTopicConfig(final String consumerGroup, final String topic,
final SubscriptionMode subscriptionMode) {
super(consumerGroup, topic, subscriptionMode, GrpcType.STREAM);
}
+ public String createKey(String ip, String pid) {
+ return ip + ":" + pid;
+ }
+
Review Comment:
1. It will be better to mark this method with `private` modifier.
2. `concat()` is better than `+` operator here. The concat() method is more
strict in what it accepts and has a better performance.
3. Maybe the `concatKey()` method name will be better, because the key has
been provided already instead of `Generated`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]