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 2389f5d61 [ISSUE #3416] Used another way to initialize localClients
instance [HttpClientGroupMapping]
2389f5d61 is described below
commit 2389f5d61407701dfcfc65a364a290789d63c74c
Author: Sam V Jose <[email protected]>
AuthorDate: Wed Apr 19 13:28:43 2023 +0530
[ISSUE #3416] Used another way to initialize localClients instance
[HttpClientGroupMapping]
* [Issue #3416] Used another way to initialize localClients instance
[HttpClientGroupMapping]
* Update HttpClientGroupMapping.java
* [ISSUE #3416] Used another way to initialize localClients instance
[HttpClientGroupMapping]
* [ISSUE #3416] Used another way to initialize localClients instance
[HttpClientGroupMapping]
---------
Co-authored-by: mike_xwm <[email protected]>
---
.../http/consumer/HttpClientGroupMapping.java | 24 +++++++++++++---------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/HttpClientGroupMapping.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/HttpClientGroupMapping.java
index a4ee48b6c..b62f1f129 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/HttpClientGroupMapping.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/HttpClientGroupMapping.java
@@ -388,11 +388,13 @@ public final class HttpClientGroupMapping {
client.setUrl(url);
client.setLastUpTime(new Date());
final String groupTopicKey = client.getConsumerGroup() + "@" +
client.getTopic();
- List<Client> localClients =
localClientInfoMapping.computeIfAbsent(groupTopicKey, key -> new
ArrayList<Client>() {
- {
- add(client);
- }
- });
+ List<Client> localClients = localClientInfoMapping.computeIfAbsent(
+ groupTopicKey, key -> Collections.unmodifiableList(new
ArrayList<Client>() {
+ private static final long serialVersionUID =
-529919988844134656L;
+ {
+ add(client);
+ }
+ }));
localClients.stream().filter(o -> StringUtils.equals(o.getUrl(),
client.getUrl())).findFirst()
.ifPresent(o -> o.setLastUpTime(client.getLastUpTime()));
}
@@ -446,11 +448,13 @@ public final class HttpClientGroupMapping {
client.setUrl(url);
client.setLastUpTime(new Date());
final String groupTopicKey = client.getConsumerGroup() + "@" +
client.getTopic();
- List<Client> localClients =
localClientInfoMapping.computeIfAbsent(groupTopicKey, key -> new
ArrayList<Client>() {
- {
- add(client);
- }
- });
+ List<Client> localClients = localClientInfoMapping.computeIfAbsent(
+ groupTopicKey, key ->
Collections.unmodifiableList(new ArrayList<Client>() {
+ private static final long
serialVersionUID = -529919988844134656L;
+ {
+ add(client);
+ }
+ }));
localClients.stream().filter(o -> StringUtils.equals(o.getUrl(),
client.getUrl())).findFirst()
.ifPresent(o -> o.setLastUpTime(client.getLastUpTime()));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]