You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "harshithasudhakar (via GitHub)" <gi...@apache.org> on 2023/04/14 08:01:39 UTC
[GitHub] [eventmesh] harshithasudhakar opened a new pull request, #3736: [ISSUE #3728] Replace this "Map.get()" and condition with a call to "Map.computeIfAbsent()". [ConsumerManager]
harshithasudhakar opened a new pull request, #3736:
URL: https://github.com/apache/eventmesh/pull/3736
Fixes #3728
### Modifications
Replaced "Map.get()" and condition with a call to "Map.computeIfAbsent()" at line 92.
### Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
- If a feature is not applicable for documentation, explain why?
- If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
--
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: dev-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org
[GitHub] [eventmesh] Alonexc commented on a diff in pull request #3736: [ISSUE #3728] Replace this "Map.get()" and condition with a call to "Map.computeIfAbsent()". [ConsumerManager]
Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc commented on code in PR #3736:
URL: https://github.com/apache/eventmesh/pull/3736#discussion_r1166476344
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/consumer/ConsumerManager.java:
##########
@@ -89,10 +89,8 @@ public void shutdown() throws Exception {
}
public EventMeshConsumer getEventMeshConsumer(final String consumerGroup) {
- EventMeshConsumer consumer = consumerTable.get(consumerGroup);
- if (consumer == null) {
- consumer = new EventMeshConsumer(eventMeshGrpcServer, consumerGroup);
- consumerTable.put(consumerGroup, consumer);
+ return consumerTable.computeIfAbsent(consumerGroup, key ->
+ consumerTable.put(consumerGroup, new EventMeshConsumer(eventMeshGrpcServer, consumerGroup)));
}
return consumer;
Review Comment:
Need to delete 93, 94 lines of code.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
[GitHub] [eventmesh] codecov[bot] commented on pull request #3736: [ISSUE #3728] Replace this "Map.get()" and condition with a call to "Map.computeIfAbsent()". [ConsumerManager]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3736:
URL: https://github.com/apache/eventmesh/pull/3736#issuecomment-1511005236
## [Codecov](https://codecov.io/gh/apache/eventmesh/pull/3736?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#3736](https://codecov.io/gh/apache/eventmesh/pull/3736?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c320d3e) into [master](https://codecov.io/gh/apache/eventmesh/commit/58b5ab715f27cf67b069f62beb6254b7ec20cdb5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (58b5ab7) will **decrease** coverage by `0.01%`.
> The diff coverage is `0.00%`.
> :exclamation: Current head c320d3e differs from pull request most recent head 16642e4. Consider uploading reports for the commit 16642e4 to get more accurate results
```diff
@@ Coverage Diff @@
## master #3736 +/- ##
============================================
- Coverage 13.76% 13.75% -0.01%
Complexity 1291 1291
============================================
Files 571 571
Lines 29234 29224 -10
Branches 2883 2870 -13
============================================
- Hits 4024 4020 -4
+ Misses 24836 24831 -5
+ Partials 374 373 -1
```
| [Impacted Files](https://codecov.io/gh/apache/eventmesh/pull/3736?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...e/core/protocol/grpc/consumer/ConsumerManager.java](https://codecov.io/gh/apache/eventmesh/pull/3736?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2NvcmUvcHJvdG9jb2wvZ3JwYy9jb25zdW1lci9Db25zdW1lck1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
... and [7 files with indirect coverage changes](https://codecov.io/gh/apache/eventmesh/pull/3736/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
[GitHub] [eventmesh] Alonexc commented on a diff in pull request #3736: [ISSUE #3728] Replace this "Map.get()" and condition with a call to "Map.computeIfAbsent()". [ConsumerManager]
Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc commented on code in PR #3736:
URL: https://github.com/apache/eventmesh/pull/3736#discussion_r1166476344
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/consumer/ConsumerManager.java:
##########
@@ -89,10 +89,8 @@ public void shutdown() throws Exception {
}
public EventMeshConsumer getEventMeshConsumer(final String consumerGroup) {
- EventMeshConsumer consumer = consumerTable.get(consumerGroup);
- if (consumer == null) {
- consumer = new EventMeshConsumer(eventMeshGrpcServer, consumerGroup);
- consumerTable.put(consumerGroup, consumer);
+ return consumerTable.computeIfAbsent(consumerGroup, key ->
+ consumerTable.put(consumerGroup, new EventMeshConsumer(eventMeshGrpcServer, consumerGroup)));
}
return consumer;
Review Comment:
Need to delete 94, 95 lines of code.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
[GitHub] [eventmesh] xwm1992 merged pull request #3736: [ISSUE #3728] Replace this "Map.get()" and condition with a call to "Map.computeIfAbsent()". [ConsumerManager]
Posted by "xwm1992 (via GitHub)" <gi...@apache.org>.
xwm1992 merged PR #3736:
URL: https://github.com/apache/eventmesh/pull/3736
--
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: dev-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org
[GitHub] [eventmesh] xwm1992 commented on pull request #3736: [ISSUE #3728] Replace this "Map.get()" and condition with a call to "Map.computeIfAbsent()". [ConsumerManager]
Posted by "xwm1992 (via GitHub)" <gi...@apache.org>.
xwm1992 commented on PR #3736:
URL: https://github.com/apache/eventmesh/pull/3736#issuecomment-1514303427
@harshithasudhakar please solve the conflicts, thanks.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org