use of com.alibaba.dubbo.common.URL in project dubbo by alibaba.
the class ProviderServiceImpl method updateProvider.
public void updateProvider(Provider provider) {
Long id = provider.getId();
if (id == null) {
throw new IllegalStateException("no provider id");
}
URL oldProvider = findProviderUrl(id);
if (oldProvider == null) {
throw new IllegalStateException("Provider was changed!");
}
URL newProvider = provider.toUrl();
registryService.unregister(oldProvider);
registryService.register(newProvider);
}
use of com.alibaba.dubbo.common.URL in project dubbo by alibaba.
the class ProviderServiceImpl method create.
public void create(Provider provider) {
URL url = provider.toUrl();
registryService.register(url);
}
use of com.alibaba.dubbo.common.URL in project dubbo by alibaba.
the class ProviderServiceImpl method findApplications.
public List<String> findApplications() {
List<String> ret = new ArrayList<String>();
ConcurrentMap<String, Map<Long, URL>> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
if (providerUrls == null)
return ret;
for (Map.Entry<String, Map<Long, URL>> e1 : providerUrls.entrySet()) {
Map<Long, URL> value = e1.getValue();
for (Map.Entry<Long, URL> e2 : value.entrySet()) {
URL u = e2.getValue();
String app = u.getParameter(Constants.APPLICATION_KEY);
if (app != null)
ret.add(app);
}
}
return ret;
}
use of com.alibaba.dubbo.common.URL in project dubbo by alibaba.
the class ProviderServiceImpl method findAddressesByService.
public List<String> findAddressesByService(String service) {
List<String> ret = new ArrayList<String>();
ConcurrentMap<String, Map<Long, URL>> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
if (null == providerUrls)
return ret;
for (Map.Entry<Long, URL> e2 : providerUrls.get(service).entrySet()) {
URL u = e2.getValue();
String app = u.getAddress();
if (app != null)
ret.add(app);
}
return ret;
}
use of com.alibaba.dubbo.common.URL in project dubbo by alibaba.
the class ProviderServiceImpl method deleteStaticProvider.
public void deleteStaticProvider(Long id) {
URL oldProvider = findProviderUrl(id);
if (oldProvider == null) {
throw new IllegalStateException("Provider was changed!");
}
registryService.unregister(oldProvider);
}
Aggregations