Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix telnet list command, the service list is displayed unordered fix… #14251

Merged
merged 4 commits into from
May 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.apache.dubbo.rpc.model.ProviderModel;

import java.util.Collection;
import java.util.Comparator;
import java.util.stream.Collectors;

@Cmd(
name = "ls",
Expand Down Expand Up @@ -53,6 +55,11 @@ public String listProvider() {
Collection<ProviderModel> providerModelList =
frameworkModel.getServiceRepository().allProviderModels();

// Fix: Originally, providers were stored in ConcurrentHashMap, Disordered display of servicekey list
providerModelList = providerModelList.stream()
.sorted(Comparator.comparing(ProviderModel::getServiceKey))
.collect(Collectors.toList());

TTable tTable = new TTable(new TTable.ColumnDefine[] {
new TTable.ColumnDefine(TTable.Align.MIDDLE), new TTable.ColumnDefine(TTable.Align.MIDDLE)
});
Expand Down Expand Up @@ -81,6 +88,11 @@ public String listConsumer() {
Collection<ConsumerModel> consumerModelList =
frameworkModel.getServiceRepository().allConsumerModels();

// Fix: Originally, consumers were stored in ConcurrentHashMap, Disordered display of servicekey list
consumerModelList = consumerModelList.stream()
.sorted(Comparator.comparing(ConsumerModel::getServiceKey))
.collect(Collectors.toList());

TTable tTable = new TTable(new TTable.ColumnDefine[] {
new TTable.ColumnDefine(TTable.Align.MIDDLE), new TTable.ColumnDefine(TTable.Align.MIDDLE)
});
Expand Down
Loading