本文整理汇总了Java中com.alibaba.dubbo.config.ReferenceConfig.setConnections方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceConfig.setConnections方法的具体用法?Java ReferenceConfig.setConnections怎么用?Java ReferenceConfig.setConnections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.config.ReferenceConfig
的用法示例。
在下文中一共展示了ReferenceConfig.setConnections方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createClient
import com.alibaba.dubbo.config.ReferenceConfig; //导入方法依赖的package包/类
protected T createClient(Class<T> cls, String targetIP, int targetPort, int connectTimeout,int clientNums){
ReferenceConfig<T> referenceConfig = new ReferenceConfig<T>();
referenceConfig.setInterface(cls);
StringBuilder url = new StringBuilder();
url.append("dubbo://");
url.append(targetIP);
url.append(":");
url.append(targetPort);
url.append("/");
url.append(cls.getName());
referenceConfig.setUrl(url.toString());
// hardcode
referenceConfig.setConnections(clientNums);
ApplicationConfig application = new ApplicationConfig();
application.setName("dubbo_consumer");
referenceConfig.setApplication(application);
referenceConfig.setTimeout(connectTimeout);
return referenceConfig.get();
}
示例2: createClient
import com.alibaba.dubbo.config.ReferenceConfig; //导入方法依赖的package包/类
protected T createClient(Class<T> cls, String targetIP, int targetPort, int connectTimeout,int clientNums, String protocol, String serialization){
ReferenceConfig<T> referenceConfig = new ReferenceConfig<T>();
referenceConfig.setInterface(cls);
StringBuilder url = new StringBuilder();
url.append(protocol);
url.append("://");
url.append(targetIP);
url.append(":");
url.append(targetPort);
url.append("/");
url.append(cls.getName());
url.append("?optimizer=com.alibaba.dubbo.rpc.benchmark.SerializationOptimizerImpl");
if (!StringUtils.isEmpty(serialization)) {
url.append("&serialization=");
url.append(serialization);
}
referenceConfig.setUrl(url.toString());
// hardcode
referenceConfig.setConnections(clientNums);
ApplicationConfig application = new ApplicationConfig();
application.setName("dubbo_consumer");
referenceConfig.setApplication(application);
referenceConfig.setTimeout(connectTimeout);
return referenceConfig.get();
}
示例3: createClient
import com.alibaba.dubbo.config.ReferenceConfig; //导入方法依赖的package包/类
/**
* 创建连接到该service上的reference bean的客户端配置实例,好吧,实际上核心就是一个url地址
*
* @param cls
* @param targetIP
* @param targetPort
* @param connectTimeout
* @param clientNums
* @return
*/
protected T createClient(Class<T> cls, String targetIP, int targetPort, int connectTimeout,int clientNums){
ReferenceConfig<T> referenceConfig = new ReferenceConfig<T>();
referenceConfig.setInterface(cls);
StringBuilder url = new StringBuilder();
url.append("dubbo://");
url.append(targetIP);
url.append(":");
url.append(targetPort);
url.append("/");
url.append(cls.getName());
referenceConfig.setUrl(url.toString());
// hardcode
referenceConfig.setConnections(clientNums);
ApplicationConfig application = new ApplicationConfig(); // 在这个里面有注册中心列表
application.setName("dubbo_consumer");
referenceConfig.setApplication(application);
referenceConfig.setTimeout(connectTimeout);
return referenceConfig.get();
}
示例4: createClient
import com.alibaba.dubbo.config.ReferenceConfig; //导入方法依赖的package包/类
protected T createClient(Class<T> cls, String targetIP, int targetPort, int connectTimeout, int clientNums) {
ReferenceConfig<T> referenceConfig = new ReferenceConfig<T>();
referenceConfig.setInterface(cls);
StringBuilder url = new StringBuilder();
url.append("dubbo://");
url.append(targetIP);
url.append(":");
url.append(targetPort);
url.append("/");
url.append(cls.getName());
referenceConfig.setUrl(url.toString());
// hardcode
referenceConfig.setConnections(clientNums);
ApplicationConfig application = new ApplicationConfig();
application.setName("dubbo_consumer");
referenceConfig.setApplication(application);
referenceConfig.setTimeout(connectTimeout);
return referenceConfig.get();
}