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/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 7a5746e34 [ISSUE #2979] replaced 'get + null check + creating empty
list'
7a5746e34 is described below
commit 7a5746e34c403ff60e2f0c2a5c207c798de1c45b
Author: dipanker <[email protected]>
AuthorDate: Mon Apr 17 14:12:13 2023 +0530
[ISSUE #2979] replaced 'get + null check + creating empty list'
---
.../http/processor/LocalUnSubscribeEventProcessor.java | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/LocalUnSubscribeEventProcessor.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/LocalUnSubscribeEventProcessor.java
index b71c23e5a..881b34185 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/LocalUnSubscribeEventProcessor.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/LocalUnSubscribeEventProcessor.java
@@ -155,12 +155,7 @@ public class LocalUnSubscribeEventProcessor extends
AbstractEventProcessor {
if (!StringUtils.equals(unSubscribeUrl,
client.getUrl())) {
clientUrls.add(client.getUrl());
- List<String> urls = idcUrls.get(client.getIdc());
- if (urls == null) {
- urls = new ArrayList<>();
- idcUrls.put(client.getIdc(), urls);
-
- }
+ List<String> urls =
idcUrls.computeIfAbsent(client.getIdc(), list -> new ArrayList<>());
urls.add(StringUtils.deleteWhitespace(client.getUrl()));
}
@@ -271,12 +266,7 @@ public class LocalUnSubscribeEventProcessor extends
AbstractEventProcessor {
final String groupTopicKey = client.getConsumerGroup() + "@" +
client.getTopic();
List<Client> localClients =
-
eventMeshHTTPServer.getSubscriptionManager().getLocalClientInfoMapping().get(groupTopicKey);
-
- if (localClients == null) {
- localClients = new ArrayList<>();
-
eventMeshHTTPServer.getSubscriptionManager().getLocalClientInfoMapping().put(groupTopicKey,
localClients);
- }
+
eventMeshHTTPServer.getSubscriptionManager().getLocalClientInfoMapping().computeIfAbsent(groupTopicKey,
list -> new ArrayList<>());
boolean isContains = false;
for (final Client localClient : localClients) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]