MCPcopy Index your code
hub / github.com/apache/dubbo-python2 / get_provider_host

Method get_provider_host

dubbo/client.py:125–143  ·  view source on GitHub ↗

从zk中可以根据接口名称获取到此接口某个provider的host :param interface: :return:

(self, interface)

Source from the content-addressed store, hash-verified

123 logger.debug('Connected or disconnected to zookeeper.')
124
125 def get_provider_host(self, interface):
126 """
127 从zk中可以根据接口名称获取到此接口某个provider的host
128 :param interface:
129 :return:
130 """
131 if interface not in self.hosts:
132 self.lock.acquire()
133 try:
134 if interface not in self.hosts:
135 path = DUBBO_ZK_PROVIDERS.format(interface)
136 if self.zk.exists(path):
137 self._get_providers_from_zk(path, interface)
138 self._get_configurators_from_zk(interface)
139 else:
140 raise RegisterException('No providers for interface {0}'.format(interface))
141 finally:
142 self.lock.release()
143 return self._routing_with_wight(interface)
144
145 def _get_providers_from_zk(self, path, interface):
146 """

Callers 1

callMethod · 0.80

Calls 5

_routing_with_wightMethod · 0.95
RegisterExceptionClass · 0.90
formatMethod · 0.80

Tested by

no test coverage detected