Java Code Examples for com.alibaba.dubbo.common.URL#toServiceString()
The following examples show how to use
com.alibaba.dubbo.common.URL#toServiceString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractRegistryFactory.java From dubbox with Apache License 2.0 | 6 votes |
public Registry getRegistry(URL url) { url = url.setPath(RegistryService.class.getName()) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .removeParameters(Constants.EXPORT_KEY, Constants.REFER_KEY); String key = url.toServiceString(); // 锁定注册中心获取过程,保证注册中心单一实例 LOCK.lock(); try { Registry registry = REGISTRIES.get(key); if (registry != null) { return registry; } registry = createRegistry(url); if (registry == null) { throw new IllegalStateException("Can not create registry " + url); } REGISTRIES.put(key, registry); return registry; } finally { // 释放锁 LOCK.unlock(); } }
Example 2
Source File: AbstractMonitorFactory.java From dubbox with Apache License 2.0 | 6 votes |
public Monitor getMonitor(URL url) { url = url.setPath(MonitorService.class.getName()).addParameter(Constants.INTERFACE_KEY, MonitorService.class.getName()); String key = url.toServiceString(); LOCK.lock(); try { Monitor monitor = MONITORS.get(key); if (monitor != null) { return monitor; } monitor = createMonitor(url); if (monitor == null) { throw new IllegalStateException("Can not create monitor " + url); } MONITORS.put(key, monitor); return monitor; } finally { // 释放锁 LOCK.unlock(); } }
Example 3
Source File: AbstractRegistryFactory.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public Registry getRegistry(URL url) { url = url.setPath(RegistryService.class.getName()) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .removeParameters(Constants.EXPORT_KEY, Constants.REFER_KEY); String key = url.toServiceString(); // 锁定注册中心获取过程,保证注册中心单一实例 LOCK.lock(); try { Registry registry = REGISTRIES.get(key); if (registry != null) { return registry; } registry = createRegistry(url); if (registry == null) { throw new IllegalStateException("Can not create registry " + url); } REGISTRIES.put(key, registry); return registry; } finally { // 释放锁 LOCK.unlock(); } }
Example 4
Source File: AbstractMonitorFactory.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public Monitor getMonitor(URL url) { url = url.setPath(MonitorService.class.getName()).addParameter(Constants.INTERFACE_KEY, MonitorService.class.getName()); String key = url.toServiceString(); LOCK.lock(); try { Monitor monitor = MONITORS.get(key); if (monitor != null) { return monitor; } monitor = createMonitor(url); if (monitor == null) { throw new IllegalStateException("Can not create monitor " + url); } MONITORS.put(key, monitor); return monitor; } finally { // 释放锁 LOCK.unlock(); } }
Example 5
Source File: AbstractRegistryFactory.java From dubbo3 with Apache License 2.0 | 6 votes |
public Registry getRegistry(URL url) { url = url.setPath(RegistryService.class.getName()) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .removeParameters(Constants.EXPORT_KEY, Constants.REFER_KEY); String key = url.toServiceString(); // 锁定注册中心获取过程,保证注册中心单一实例 LOCK.lock(); try { Registry registry = REGISTRIES.get(key); if (registry != null) { return registry; } registry = createRegistry(url); if (registry == null) { throw new IllegalStateException("Can not create registry " + url); } REGISTRIES.put(key, registry); return registry; } finally { // 释放锁 LOCK.unlock(); } }
Example 6
Source File: AbstractMonitorFactory.java From dubbo3 with Apache License 2.0 | 6 votes |
public Monitor getMonitor(URL url) { url = url.setPath(MonitorService.class.getName()).addParameter(Constants.INTERFACE_KEY, MonitorService.class.getName()); String key = url.toServiceString(); LOCK.lock(); try { Monitor monitor = MONITORS.get(key); if (monitor != null) { return monitor; } monitor = createMonitor(url); if (monitor == null) { throw new IllegalStateException("Can not create monitor " + url); } MONITORS.put(key, monitor); return monitor; } finally { // 释放锁 LOCK.unlock(); } }
Example 7
Source File: AbstractRegistryFactory.java From dubbox with Apache License 2.0 | 6 votes |
public Registry getRegistry(URL url) { url = url.setPath(RegistryService.class.getName()) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .removeParameters(Constants.EXPORT_KEY, Constants.REFER_KEY); String key = url.toServiceString(); // 锁定注册中心获取过程,保证注册中心单一实例 LOCK.lock(); try { Registry registry = REGISTRIES.get(key); if (registry != null) { return registry; } registry = createRegistry(url); if (registry == null) { throw new IllegalStateException("Can not create registry " + url); } REGISTRIES.put(key, registry); return registry; } finally { // 释放锁 LOCK.unlock(); } }
Example 8
Source File: AbstractMonitorFactory.java From dubbox with Apache License 2.0 | 6 votes |
public Monitor getMonitor(URL url) { url = url.setPath(MonitorService.class.getName()).addParameter(Constants.INTERFACE_KEY, MonitorService.class.getName()); String key = url.toServiceString(); LOCK.lock(); try { Monitor monitor = MONITORS.get(key); if (monitor != null) { return monitor; } monitor = createMonitor(url); if (monitor == null) { throw new IllegalStateException("Can not create monitor " + url); } MONITORS.put(key, monitor); return monitor; } finally { // 释放锁 LOCK.unlock(); } }
Example 9
Source File: AbstractRegistryFactory.java From dubbox with Apache License 2.0 | 6 votes |
public Registry getRegistry(URL url) { url = url.setPath(RegistryService.class.getName()) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .removeParameters(Constants.EXPORT_KEY, Constants.REFER_KEY); String key = url.toServiceString(); // 锁定注册中心获取过程,保证注册中心单一实例 LOCK.lock(); try { Registry registry = REGISTRIES.get(key); if (registry != null) { return registry; } registry = createRegistry(url); if (registry == null) { throw new IllegalStateException("Can not create registry " + url); } REGISTRIES.put(key, registry); return registry; } finally { // 释放锁 LOCK.unlock(); } }
Example 10
Source File: AbstractMonitorFactory.java From dubbox with Apache License 2.0 | 6 votes |
public Monitor getMonitor(URL url) { url = url.setPath(MonitorService.class.getName()).addParameter(Constants.INTERFACE_KEY, MonitorService.class.getName()); String key = url.toServiceString(); LOCK.lock(); try { Monitor monitor = MONITORS.get(key); if (monitor != null) { return monitor; } monitor = createMonitor(url); if (monitor == null) { throw new IllegalStateException("Can not create monitor " + url); } MONITORS.put(key, monitor); return monitor; } finally { // 释放锁 LOCK.unlock(); } }
Example 11
Source File: AbstractRegistryFactory.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Override public Registry getRegistry(URL url) { // zookeeper://192.168.50.251:2181/com.alibaba.dubbo.registry.RegistryService?application=dubbo-provider&dubbo=2.0.2&interface=com.alibaba.dubbo.registry.RegistryService&pid=14414×tamp=1573209627099 url = url.setPath(RegistryService.class.getName()) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .removeParameters(Constants.EXPORT_KEY, Constants.REFER_KEY); // zookeeper://192.168.50.251:2181/com.alibaba.dubbo.registry.RegistryService String key = url.toServiceString(); // Lock the registry access process to ensure a single instance of the registry 锁定注册表访问过程,以确保注册表的单个实例 LOCK.lock(); try { // 查询注册表 Registry registry = REGISTRIES.get(key); if (registry != null) { return registry; } // 创建注册信息=》ZookeeperRegistry registry = createRegistry(url); if (registry == null) { throw new IllegalStateException("Can not create registry " + url); } REGISTRIES.put(key, registry); return registry; } finally { // Release the lock LOCK.unlock(); } }