maobaolong commented on a change in pull request #1051:
URL: https://github.com/apache/hadoop-ozone/pull/1051#discussion_r442617207
##########
File path:
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/ListPipelinesSubcommand.java
##########
@@ -54,17 +54,12 @@
@Override
public Void call() throws Exception {
try (ScmClient scmClient = parent.getParent().createScmClient()) {
- if (Strings.isNullOrEmpty(factor) && Strings.isNullOrEmpty(state)) {
- scmClient.listPipelines().forEach(System.out::println);
- } else {
- scmClient.listPipelines().stream()
- .filter(p -> ((Strings.isNullOrEmpty(factor) ||
- (p.getFactor().toString().compareToIgnoreCase(factor) == 0))
- && (Strings.isNullOrEmpty(state) ||
- (p.getPipelineState().toString().compareToIgnoreCase(state)
- == 0))))
- .forEach(System.out::println);
- }
+ scmClient.listPipelines().stream()
+ .filter(p -> ((Strings.isNullOrEmpty(factor)
+ || (p.getFactor().toString().compareToIgnoreCase(factor) == 0))
+ && (Strings.isNullOrEmpty(state) || (p.getPipelineState()
+ .toString().compareToIgnoreCase(state) == 0))))
+ .forEach(System.out::println);
Review comment:
@bhemanthkumar i think the changes within the try block @adoroszlai is
```java
Stream<Pipeline> stream = scmClient.listPipelines().stream();
if (!Strings.isNullOrEmpty(factor)) {
stream =
stream.filter(p -> p.getFactor().toString()
.compareToIgnoreCase(factor) == 0);
}
if (!Strings.isNullOrEmpty(state)) {
stream =
stream.filter(p -> p.getPipelineState().toString()
.compareToIgnoreCase(state) == 0);
}
stream.forEach(System.out::println);
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]