Check if protocol already found before going through ConsumerConfig. (#13510)
* Check if protocol already found before going through ConsumerConfig. * fix spotless issue
This commit is contained in:
parent
cb5ff2aace
commit
2a0755c279
|
|
@ -163,16 +163,18 @@ public class InternalServiceConfigBuilder<T> {
|
|||
}
|
||||
}
|
||||
// <dubbo:consumer/>
|
||||
protocol = moduleModels.stream()
|
||||
.map(ModuleModel::getConfigManager)
|
||||
.map(ModuleConfigManager::getConsumers)
|
||||
.filter(CollectionUtils::isNotEmpty)
|
||||
.flatMap(Collection::stream)
|
||||
.map(ConsumerConfig::getProtocol)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.filter(p -> ACCEPTABLE_PROTOCOL.contains(p))
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
if (StringUtils.isEmpty(protocol)) {
|
||||
protocol = moduleModels.stream()
|
||||
.map(ModuleModel::getConfigManager)
|
||||
.map(ModuleConfigManager::getConsumers)
|
||||
.filter(CollectionUtils::isNotEmpty)
|
||||
.flatMap(Collection::stream)
|
||||
.map(ConsumerConfig::getProtocol)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.filter(p -> ACCEPTABLE_PROTOCOL.contains(p))
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
}
|
||||
return StringUtils.isNotEmpty(protocol) && ACCEPTABLE_PROTOCOL.contains(protocol) ? protocol : DUBBO_PROTOCOL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue