Skip to content

Commit

Permalink
[ISSUE #2979] replaced 'get + null check + creating empty list'
Browse files Browse the repository at this point in the history
  • Loading branch information
dipankr committed Apr 17, 2023
1 parent effa041 commit 7a5746e
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,7 @@ public void handler(final HandlerService.HandlerSpecific handlerSpecific, final
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()));
}

Expand Down Expand Up @@ -271,12 +266,7 @@ private void registerClient(final HttpEventWrapper requestWrapper,
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) {
Expand Down

0 comments on commit 7a5746e

Please sign in to comment.