客户端连接控制
或
限制客户端服务使用连接不能超过 10 个。
如果 和 都配了 connections, 优先。
配置参数为connections。
public class DubboProtocol extends AbstractProtocol {
private ExchangeClient[] getClients(URL url) {
// whether to share connection
boolean service_share_connect = false;
// String CONNECTIONS_KEY = "connections";
int connections = url.getParameter(Constants.CONNECTIONS_KEY, 0);
// if not configured, connection is shared, otherwise, one connection for one service
if (connections == 0) {
service_share_connect = true;
connections = 1;
}
// 如果设置了最大连接数,就不走共享连接,直接创建指定个数的连接。
ExchangeClient[] clients = new ExchangeClient[connections];
for (int i = 0; i < clients.length; i++) {
if (service_share_connect) {