com.alibaba.dubbo.rpc.cluster.Cluster Java Examples

The following examples show how to use com.alibaba.dubbo.rpc.cluster.Cluster. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RegistryProtocol.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
private <T> Invoker<T> doRefer(Cluster cluster, Registry registry, Class<T> type, URL url) {
    RegistryDirectory<T> directory = new RegistryDirectory<T>(type, url);
    directory.setRegistry(registry);
    directory.setProtocol(protocol);
    URL subscribeUrl = new URL(Constants.CONSUMER_PROTOCOL, NetUtils.getLocalHost(), 0, type.getName(), directory.getUrl().getParameters());
    if (! Constants.ANY_VALUE.equals(url.getServiceInterface())
            && url.getParameter(Constants.REGISTER_KEY, true)) {
        registry.register(subscribeUrl.addParameters(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY,
                Constants.CHECK_KEY, String.valueOf(false)));
    }
    directory.subscribe(subscribeUrl.addParameter(Constants.CATEGORY_KEY, 
            Constants.PROVIDERS_CATEGORY 
            + "," + Constants.CONFIGURATORS_CATEGORY 
            + "," + Constants.ROUTERS_CATEGORY));
    return cluster.join(directory);
}
 
Example #2
Source File: RegistryProtocol.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private <T> Invoker<T> doRefer(Cluster cluster, Registry registry, Class<T> type, URL url) {
    RegistryDirectory<T> directory = new RegistryDirectory<T>(type, url);
    directory.setRegistry(registry);
    directory.setProtocol(protocol);
    URL subscribeUrl = new URL(Constants.CONSUMER_PROTOCOL, NetUtils.getLocalHost(), 0, type.getName(), directory.getUrl().getParameters());
    if (! Constants.ANY_VALUE.equals(url.getServiceInterface())
            && url.getParameter(Constants.REGISTER_KEY, true)) {
        registry.register(subscribeUrl.addParameters(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY,
                Constants.CHECK_KEY, String.valueOf(false)));
    }
    directory.subscribe(subscribeUrl.addParameter(Constants.CATEGORY_KEY, 
            Constants.PROVIDERS_CATEGORY 
            + "," + Constants.CONFIGURATORS_CATEGORY 
            + "," + Constants.ROUTERS_CATEGORY));
    return cluster.join(directory);
}
 
Example #3
Source File: RegistryProtocol.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private <T> Invoker<T> doRefer(Cluster cluster, Registry registry, Class<T> type, URL url) {
    RegistryDirectory<T> directory = new RegistryDirectory<T>(type, url);
    directory.setRegistry(registry);
    directory.setProtocol(protocol);
    URL subscribeUrl = new URL(Constants.CONSUMER_PROTOCOL, NetUtils.getLocalHost(), 0, type.getName(), directory.getUrl().getParameters());
    if (! Constants.ANY_VALUE.equals(url.getServiceInterface())
            && url.getParameter(Constants.REGISTER_KEY, true)) {
        registry.register(subscribeUrl.addParameters(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY,
                Constants.CHECK_KEY, String.valueOf(false)));
    }
    directory.subscribe(subscribeUrl.addParameter(Constants.CATEGORY_KEY, 
            Constants.PROVIDERS_CATEGORY 
            + "," + Constants.CONFIGURATORS_CATEGORY 
            + "," + Constants.ROUTERS_CATEGORY));
    return cluster.join(directory);
}
 
Example #4
Source File: RegistryProtocol.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
private <T> Invoker<T> doRefer(Cluster cluster, Registry registry, Class<T> type, URL url) {
    RegistryDirectory<T> directory = new RegistryDirectory<T>(type, url);
    directory.setRegistry(registry);
    directory.setProtocol(protocol);
    URL subscribeUrl = new URL(Constants.CONSUMER_PROTOCOL, NetUtils.getLocalHost(), 0, type.getName(), directory.getUrl().getParameters());
    if (! Constants.ANY_VALUE.equals(url.getServiceInterface())
            && url.getParameter(Constants.REGISTER_KEY, true)) {
        registry.register(subscribeUrl.addParameters(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY,
                Constants.CHECK_KEY, String.valueOf(false)));
    }
    directory.subscribe(subscribeUrl.addParameter(Constants.CATEGORY_KEY, 
            Constants.PROVIDERS_CATEGORY 
            + "," + Constants.CONFIGURATORS_CATEGORY 
            + "," + Constants.ROUTERS_CATEGORY));
    return cluster.join(directory);
}
 
Example #5
Source File: RegistryProtocol.java    From dubbox with Apache License 2.0 6 votes vote down vote up
private <T> Invoker<T> doRefer(Cluster cluster, Registry registry, Class<T> type, URL url) {
    RegistryDirectory<T> directory = new RegistryDirectory<T>(type, url);
    directory.setRegistry(registry);
    directory.setProtocol(protocol);
    URL subscribeUrl = new URL(Constants.CONSUMER_PROTOCOL, NetUtils.getLocalHost(), 0, type.getName(), directory.getUrl().getParameters());
    if (! Constants.ANY_VALUE.equals(url.getServiceInterface())
            && url.getParameter(Constants.REGISTER_KEY, true)) {
        registry.register(subscribeUrl.addParameters(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY,
                Constants.CHECK_KEY, String.valueOf(false)));
    }
    directory.subscribe(subscribeUrl.addParameter(Constants.CATEGORY_KEY, 
            Constants.PROVIDERS_CATEGORY 
            + "," + Constants.CONFIGURATORS_CATEGORY 
            + "," + Constants.ROUTERS_CATEGORY));
    return cluster.join(directory);
}
 
Example #6
Source File: RegistryProtocol.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
private <T> Invoker<T> doRefer(Cluster cluster, Registry registry, Class<T> type, URL url) {
        RegistryDirectory<T> directory = new RegistryDirectory<T>(type, url);
        directory.setRegistry(registry);
        directory.setProtocol(protocol);
        // all attributes of REFER_KEY
        Map<String, String> parameters = new HashMap<String, String>(directory.getUrl().getParameters());
//        订阅的url consumer
//        consumer://192.168.43.108/com.alibaba.dubbo.demo.DemoService?application=demo-consumer&check=false&default.client=netty4&dubbo=2.0.2&interface=com.alibaba.dubbo.demo.DemoService&methods=sayHello&pid=84351&qos.port=33333&side=consumer&timeout=3000000&timestamp=1570892444487
        URL subscribeUrl = new URL(Constants.CONSUMER_PROTOCOL, parameters.remove(Constants.REGISTER_IP_KEY), 0, type.getName(), parameters);
//        不是订阅所有接口
        if (!Constants.ANY_VALUE.equals(url.getServiceInterface())
                && url.getParameter(Constants.REGISTER_KEY, true)) {
//            注册订阅=》com.alibaba.dubbo.registry.support.FailbackRegistry.register()
            registry.register(subscribeUrl.addParameters(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY,
                    Constants.CHECK_KEY, String.valueOf(false)));
        }
//        订阅=》
        directory.subscribe(subscribeUrl.addParameter(Constants.CATEGORY_KEY,
                Constants.PROVIDERS_CATEGORY
                        + "," + Constants.CONFIGURATORS_CATEGORY
                        + "," + Constants.ROUTERS_CATEGORY));

        Invoker invoker = cluster.join(directory);
//        生产者消费者注册表注册消费者=》
        ProviderConsumerRegTable.registerConsumer(invoker, url, subscribeUrl, directory);
        return invoker;
    }
 
Example #7
Source File: RegistryProtocol.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public void setCluster(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #8
Source File: AbstractInterfaceConfig.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
public void setCluster(String cluster) {
    checkExtension(Cluster.class, "cluster", cluster);
    this.cluster = cluster;
}
 
Example #9
Source File: RegistryProtocol.java    From dubbox with Apache License 2.0 4 votes vote down vote up
private Cluster getMergeableCluster() {
    return ExtensionLoader.getExtensionLoader(Cluster.class).getExtension("mergeable");
}
 
Example #10
Source File: RegistryProtocol.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void setCluster(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #11
Source File: DubboRegistryFactory.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void setCluster(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #12
Source File: AbstractInterfaceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void setCluster(String cluster) {
    checkExtension(Cluster.class, "cluster", cluster);
    this.cluster = cluster;
}
 
Example #13
Source File: MockClusterWrapper.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public MockClusterWrapper(Cluster cluster) {
	this.cluster = cluster;
}
 
Example #14
Source File: DubboRegistryFactory.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
public void setCluster(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #15
Source File: RegistryProtocol.java    From dubbox with Apache License 2.0 4 votes vote down vote up
private Cluster getMergeableCluster() {
    return ExtensionLoader.getExtensionLoader(Cluster.class).getExtension("mergeable");
}
 
Example #16
Source File: RegistryProtocol.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void setCluster(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #17
Source File: DubboRegistryFactory.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void setCluster(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #18
Source File: AbstractInterfaceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void setCluster(String cluster) {
    checkExtension(Cluster.class, "cluster", cluster);
    this.cluster = cluster;
}
 
Example #19
Source File: MockClusterWrapper.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public MockClusterWrapper(Cluster cluster) {
	this.cluster = cluster;
}
 
Example #20
Source File: RegistryProtocol.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
public void setCluster(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #21
Source File: RegistryProtocol.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
private Cluster getMergeableCluster() {
    return ExtensionLoader.getExtensionLoader(Cluster.class).getExtension("mergeable");
}
 
Example #22
Source File: AbstractInterfaceConfig.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public void setCluster(String cluster) {
    checkExtension(Cluster.class, "cluster", cluster);
    this.cluster = cluster;
}
 
Example #23
Source File: MockClusterWrapper.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public MockClusterWrapper(Cluster cluster) {
	this.cluster = cluster;
}
 
Example #24
Source File: MockClusterWrapper.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
public MockClusterWrapper(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #25
Source File: RegistryProtocol.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
private Cluster getMergeableCluster() {
    return ExtensionLoader.getExtensionLoader(Cluster.class).getExtension("mergeable");
}
 
Example #26
Source File: RegistryProtocol.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public void setCluster(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #27
Source File: DubboRegistryFactory.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public void setCluster(Cluster cluster) {
    this.cluster = cluster;
}
 
Example #28
Source File: AbstractInterfaceConfig.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public void setCluster(String cluster) {
    checkExtension(Cluster.class, "cluster", cluster);
    this.cluster = cluster;
}
 
Example #29
Source File: MockClusterWrapper.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public MockClusterWrapper(Cluster cluster) {
	this.cluster = cluster;
}
 
Example #30
Source File: RegistryProtocol.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
private Cluster getMergeableCluster() {
    return ExtensionLoader.getExtensionLoader(Cluster.class).getExtension("mergeable");
}