use of org.apache.dubbo.remoting.Client in project dubbo by alibaba.
the class ServerPeer method getChannel.
@Override
public Channel getChannel(InetSocketAddress remoteAddress) {
String host = remoteAddress.getAddress() != null ? remoteAddress.getAddress().getHostAddress() : remoteAddress.getHostName();
int port = remoteAddress.getPort();
Channel channel = super.getChannel(remoteAddress);
if (channel == null) {
for (Map.Entry<URL, Client> entry : clients.entrySet()) {
URL url = entry.getKey();
if (url.getIp().equals(host) && url.getPort() == port) {
return entry.getValue();
}
}
}
return channel;
}
use of org.apache.dubbo.remoting.Client in project dubbo by alibaba.
the class AbstractGroup method connect.
protected Client connect(URL url) throws RemotingException {
if (servers.containsKey(url)) {
return null;
}
Client client = clients.get(url);
if (client == null) {
// TODO exist concurrent gap
client = Transporters.connect(url, dispatcher);
clients.put(url, client);
}
return client;
}