Search in sources :

Example 1 with ConcurrentHashMapEx

use of org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx in project incubator-servicecomb-java-chassis by apache.

the class OperationInstancesDiscoveryFilter method initOperationNodes.

protected Map<String, DiscoveryTreeNode> initOperationNodes(DiscoveryTreeNode parent, Map<MicroserviceVersionMeta, Map<String, MicroserviceInstance>> versionMap) {
    Map<String, DiscoveryTreeNode> tmpChildren = new ConcurrentHashMapEx<>();
    versionMap.keySet().stream().sorted(Comparator.comparing(MicroserviceVersion::getVersion)).forEach(meta -> {
        for (OperationMeta operationMeta : meta.getMicroserviceMeta().getOperations()) {
            tmpChildren.computeIfAbsent(operationMeta.getMicroserviceQualifiedName(), qualifiedName -> {
                VersionRule versionRule = VersionRuleUtils.getOrCreate(meta.getVersion().getVersion() + "+");
                return new DiscoveryTreeNode().attribute(VERSION_RULE, versionRule).subName(parent, versionRule.getVersionRule()).data(new HashMap<>());
            });
        }
    });
    return tmpChildren;
}
Also used : MicroserviceVersion(org.apache.servicecomb.serviceregistry.consumer.MicroserviceVersion) DiscoveryTreeNode(org.apache.servicecomb.serviceregistry.discovery.DiscoveryTreeNode) OperationMeta(org.apache.servicecomb.core.definition.OperationMeta) ConcurrentHashMapEx(org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx) VersionRule(org.apache.servicecomb.serviceregistry.version.VersionRule)

Aggregations

OperationMeta (org.apache.servicecomb.core.definition.OperationMeta)1 ConcurrentHashMapEx (org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx)1 MicroserviceVersion (org.apache.servicecomb.serviceregistry.consumer.MicroserviceVersion)1 DiscoveryTreeNode (org.apache.servicecomb.serviceregistry.discovery.DiscoveryTreeNode)1 VersionRule (org.apache.servicecomb.serviceregistry.version.VersionRule)1