Search in sources :

Example 1 with ClusterInvoker

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

the class RegistryProtocol method doCreateInvoker.

protected <T> ClusterInvoker<T> doCreateInvoker(DynamicDirectory<T> directory, Cluster cluster, Registry registry, Class<T> type) {
    directory.setRegistry(registry);
    directory.setProtocol(protocol);
    // all attributes of REFER_KEY
    Map<String, String> parameters = new HashMap<String, String>(directory.getConsumerUrl().getParameters());
    URL urlToRegistry = new URL(CONSUMER_PROTOCOL, parameters.remove(REGISTER_IP_KEY), 0, type.getName(), parameters);
    if (directory.isShouldRegister()) {
        directory.setRegisteredConsumerUrl(urlToRegistry);
        registry.register(directory.getRegisteredConsumerUrl());
    }
    directory.buildRouterChain(urlToRegistry);
    directory.subscribe(toSubscribeUrl(urlToRegistry));
    return (ClusterInvoker<T>) cluster.join(directory);
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ClusterInvoker(org.apache.dubbo.rpc.cluster.ClusterInvoker) MigrationClusterInvoker(org.apache.dubbo.rpc.cluster.support.migration.MigrationClusterInvoker) URL(org.apache.dubbo.common.URL)

Aggregations

HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 URL (org.apache.dubbo.common.URL)1 ClusterInvoker (org.apache.dubbo.rpc.cluster.ClusterInvoker)1 MigrationClusterInvoker (org.apache.dubbo.rpc.cluster.support.migration.MigrationClusterInvoker)1