Search in sources :

Example 1 with Cluster

use of org.apache.dubbo.rpc.cluster.Cluster in project dubbo by alibaba.

the class RegistryProtocol method refer.

@Override
@SuppressWarnings("unchecked")
public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException {
    url = getRegistryUrl(url);
    Registry registry = getRegistry(url);
    if (RegistryService.class.equals(type)) {
        return proxyFactory.getInvoker((T) registry, type, url);
    }
    // group="a,b" or group="*"
    Map<String, String> qs = StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY));
    String group = qs.get(GROUP_KEY);
    if (group != null && group.length() > 0) {
        if ((COMMA_SPLIT_PATTERN.split(group)).length > 1 || "*".equals(group)) {
            return doRefer(Cluster.getCluster(MergeableCluster.NAME), registry, type, url, qs);
        }
    }
    Cluster cluster = Cluster.getCluster(qs.get(CLUSTER_KEY));
    return doRefer(cluster, registry, type, url, qs);
}
Also used : MergeableCluster(org.apache.dubbo.rpc.cluster.support.MergeableCluster) Cluster(org.apache.dubbo.rpc.cluster.Cluster) Registry(org.apache.dubbo.registry.Registry)

Aggregations

Registry (org.apache.dubbo.registry.Registry)1 Cluster (org.apache.dubbo.rpc.cluster.Cluster)1 MergeableCluster (org.apache.dubbo.rpc.cluster.support.MergeableCluster)1