Java Code Examples for com.alibaba.dubbo.common.URL#getServiceKey()
The following examples show how to use
com.alibaba.dubbo.common.URL#getServiceKey() .
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: ProviderConsumerRegTable.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
public static ProviderInvokerWrapper getProviderWrapper(Invoker invoker) { URL providerUrl = invoker.getUrl(); if (Constants.REGISTRY_PROTOCOL.equals(providerUrl.getProtocol())) { providerUrl = URL.valueOf(providerUrl.getParameterAndDecoded(Constants.EXPORT_KEY)); } String serviceUniqueName = providerUrl.getServiceKey(); Set<ProviderInvokerWrapper> invokers = providerInvokers.get(serviceUniqueName); if (invokers == null) { return null; } for (ProviderInvokerWrapper providerWrapper : invokers) { Invoker providerInvoker = providerWrapper.getInvoker(); if (providerInvoker == invoker) { return providerWrapper; } } return null; }
Example 2
Source File: JCache.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
public JCache(URL url) { String method = url.getParameter(Constants.METHOD_KEY, ""); String key = url.getAddress() + "." + url.getServiceKey() + "." + method; // jcache parameter is the full-qualified class name of SPI implementation String type = url.getParameter("jcache"); CachingProvider provider = type == null || type.length() == 0 ? Caching.getCachingProvider() : Caching.getCachingProvider(type); CacheManager cacheManager = provider.getCacheManager(); Cache<Object, Object> cache = cacheManager.getCache(key); if (cache == null) { try { //configure the cache MutableConfiguration config = new MutableConfiguration<Object, Object>() .setTypes(Object.class, Object.class) .setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MILLISECONDS, url.getMethodParameter(method, "cache.write.expire", 60 * 1000)))) .setStoreByValue(false) .setManagementEnabled(true) .setStatisticsEnabled(true); cache = cacheManager.createCache(key, config); } catch (CacheException e) { // concurrent cache initialization cache = cacheManager.getCache(key); } } this.store = cache; }
Example 3
Source File: RegistryDirectory.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
public RegistryDirectory(Class<T> serviceType, URL url) { super(url); if (serviceType == null) throw new IllegalArgumentException("service type is null."); if (url.getServiceKey() == null || url.getServiceKey().length() == 0) throw new IllegalArgumentException("registry serviceKey is null."); this.serviceType = serviceType; this.serviceKey = url.getServiceKey(); this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.overrideDirectoryUrl = this.directoryUrl = url.setPath(url.getServiceInterface()).clearParameters().addParameters(queryMap).removeParameter(Constants.MONITOR_KEY); String group = directoryUrl.getParameter(Constants.GROUP_KEY, ""); this.multiGroup = group != null && ("*".equals(group) || group.contains(",")); String methods = queryMap.get(Constants.METHODS_KEY); this.serviceMethods = methods == null ? null : Constants.COMMA_SPLIT_PATTERN.split(methods); }
Example 4
Source File: ProviderConsumerRegTable.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
public static void registerProvider(Invoker invoker, URL registryUrl, URL providerUrl) { ProviderInvokerWrapper wrapperInvoker = new ProviderInvokerWrapper(invoker, registryUrl, providerUrl); // service唯一的名字 group/interface:version helloGroup/com.tianhe.lianxi.dubbo.api.HelloFacade:1.0.0 String serviceUniqueName = providerUrl.getServiceKey(); Set<ProviderInvokerWrapper> invokers = providerInvokers.get(serviceUniqueName); if (invokers == null) { providerInvokers.putIfAbsent(serviceUniqueName, new ConcurrentHashSet<ProviderInvokerWrapper>()); // ProviderInvokerWrapper invokers = providerInvokers.get(serviceUniqueName); } invokers.add(wrapperInvoker); }
Example 5
Source File: ProviderConsumerRegTable.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
public static void registerConsumer(Invoker invoker, URL registryUrl, URL consumerUrl, RegistryDirectory registryDirectory) { ConsumerInvokerWrapper wrapperInvoker = new ConsumerInvokerWrapper(invoker, registryUrl, consumerUrl, registryDirectory); // 服务唯一标识 group/interface:version String serviceUniqueName = consumerUrl.getServiceKey(); Set<ConsumerInvokerWrapper> invokers = consumerInvokers.get(serviceUniqueName); if (invokers == null) { consumerInvokers.putIfAbsent(serviceUniqueName, new ConcurrentHashSet<ConsumerInvokerWrapper>()); invokers = consumerInvokers.get(serviceUniqueName); } invokers.add(wrapperInvoker); }
Example 6
Source File: RegistryDirectory.java From dubbox with Apache License 2.0 | 5 votes |
public RegistryDirectory(Class<T> serviceType, URL url) { super(url); if(serviceType == null ) throw new IllegalArgumentException("service type is null."); if(url.getServiceKey() == null || url.getServiceKey().length() == 0) throw new IllegalArgumentException("registry serviceKey is null."); this.serviceType = serviceType; this.serviceKey = url.getServiceKey(); this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.overrideDirectoryUrl = this.directoryUrl = url.setPath(url.getServiceInterface()).clearParameters().addParameters(queryMap).removeParameter(Constants.MONITOR_KEY); String group = directoryUrl.getParameter( Constants.GROUP_KEY, "" ); this.multiGroup = group != null && ("*".equals(group) || group.contains( "," )); String methods = queryMap.get(Constants.METHODS_KEY); this.serviceMethods = methods == null ? null : Constants.COMMA_SPLIT_PATTERN.split(methods); }
Example 7
Source File: RegistryDirectory.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public RegistryDirectory(Class<T> serviceType, URL url) { super(url); if(serviceType == null ) throw new IllegalArgumentException("service type is null."); if(url.getServiceKey() == null || url.getServiceKey().length() == 0) throw new IllegalArgumentException("registry serviceKey is null."); this.serviceType = serviceType; this.serviceKey = url.getServiceKey(); this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.overrideDirectoryUrl = this.directoryUrl = url.setPath(url.getServiceInterface()).clearParameters().addParameters(queryMap).removeParameter(Constants.MONITOR_KEY); String group = directoryUrl.getParameter( Constants.GROUP_KEY, "" ); this.multiGroup = group != null && ("*".equals(group) || group.contains( "," )); String methods = queryMap.get(Constants.METHODS_KEY); this.serviceMethods = methods == null ? null : Constants.COMMA_SPLIT_PATTERN.split(methods); }
Example 8
Source File: RegistryDirectory.java From dubbo3 with Apache License 2.0 | 5 votes |
public RegistryDirectory(Class<T> serviceType, URL url) { super(url); if (serviceType == null) throw new IllegalArgumentException("service type is null."); if (url.getServiceKey() == null || url.getServiceKey().length() == 0) throw new IllegalArgumentException("registry serviceKey is null."); this.serviceType = serviceType; this.serviceKey = url.getServiceKey(); this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.overrideDirectoryUrl = this.directoryUrl = url.setPath(url.getServiceInterface()).clearParameters().addParameters(queryMap).removeParameter(Constants.MONITOR_KEY); String group = directoryUrl.getParameter(Constants.GROUP_KEY, ""); this.multiGroup = group != null && ("*".equals(group) || group.contains(",")); String methods = queryMap.get(Constants.METHODS_KEY); this.serviceMethods = methods == null ? null : Constants.COMMA_SPLIT_PATTERN.split(methods); }
Example 9
Source File: RegistryDirectory.java From dubbox with Apache License 2.0 | 5 votes |
public RegistryDirectory(Class<T> serviceType, URL url) { super(url); if(serviceType == null ) throw new IllegalArgumentException("service type is null."); if(url.getServiceKey() == null || url.getServiceKey().length() == 0) throw new IllegalArgumentException("registry serviceKey is null."); this.serviceType = serviceType; this.serviceKey = url.getServiceKey(); this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.overrideDirectoryUrl = this.directoryUrl = url.setPath(url.getServiceInterface()).clearParameters().addParameters(queryMap).removeParameter(Constants.MONITOR_KEY); String group = directoryUrl.getParameter( Constants.GROUP_KEY, "" ); this.multiGroup = group != null && ("*".equals(group) || group.contains( "," )); String methods = queryMap.get(Constants.METHODS_KEY); this.serviceMethods = methods == null ? null : Constants.COMMA_SPLIT_PATTERN.split(methods); }
Example 10
Source File: RegistryDirectory.java From dubbox with Apache License 2.0 | 5 votes |
public RegistryDirectory(Class<T> serviceType, URL url) { super(url); if(serviceType == null ) throw new IllegalArgumentException("service type is null."); if(url.getServiceKey() == null || url.getServiceKey().length() == 0) throw new IllegalArgumentException("registry serviceKey is null."); this.serviceType = serviceType; this.serviceKey = url.getServiceKey(); this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); this.overrideDirectoryUrl = this.directoryUrl = url.setPath(url.getServiceInterface()).clearParameters().addParameters(queryMap).removeParameter(Constants.MONITOR_KEY); String group = directoryUrl.getParameter( Constants.GROUP_KEY, "" ); this.multiGroup = group != null && ("*".equals(group) || group.contains( "," )); String methods = queryMap.get(Constants.METHODS_KEY); this.serviceMethods = methods == null ? null : Constants.COMMA_SPLIT_PATTERN.split(methods); }
Example 11
Source File: InjvmProtocol.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
@Override public <T> Invoker<T> refer(Class<T> serviceType, URL url) throws RpcException { return new InjvmInvoker<T>(serviceType, url, url.getServiceKey(), exporterMap); }
Example 12
Source File: InjvmProtocol.java From dubbox with Apache License 2.0 | 4 votes |
public <T> Invoker<T> refer(Class<T> serviceType, URL url) throws RpcException { return new InjvmInvoker<T>(serviceType, url, url.getServiceKey(), exporterMap); }
Example 13
Source File: InjvmProtocol.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public <T> Invoker<T> refer(Class<T> serviceType, URL url) throws RpcException { return new InjvmInvoker<T>(serviceType, url, url.getServiceKey(), exporterMap); }
Example 14
Source File: InjvmProtocol.java From dubbo3 with Apache License 2.0 | 4 votes |
public <T> Invoker<T> refer(Class<T> serviceType, URL url) throws RpcException { return new InjvmInvoker<T>(serviceType, url, url.getServiceKey(), exporterMap); }
Example 15
Source File: InjvmProtocol.java From dubbox with Apache License 2.0 | 4 votes |
public <T> Invoker<T> refer(Class<T> serviceType, URL url) throws RpcException { return new InjvmInvoker<T>(serviceType, url, url.getServiceKey(), exporterMap); }
Example 16
Source File: InjvmProtocol.java From dubbox with Apache License 2.0 | 4 votes |
public <T> Invoker<T> refer(Class<T> serviceType, URL url) throws RpcException { return new InjvmInvoker<T>(serviceType, url, url.getServiceKey(), exporterMap); }