com.alibaba.dubbo.governance.sync.util.SyncUtils Java Examples

The following examples show how to use com.alibaba.dubbo.governance.sync.util.SyncUtils. 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: ConsumerServiceImpl.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public Map<Long, URL> findConsumerUrlByService(String service) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #2
Source File: ConsumerServiceImpl.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findConsumerUrlByAddress(String address) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #3
Source File: ProviderServiceImpl.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findProviderUrlByService(String service) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
    filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #4
Source File: ConsumerServiceImpl.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findConsumerUrlByAddress(String address) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #5
Source File: ConsumerServiceImpl.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findConsumerUrlByApplication(String application) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    filter.put(Constants.APPLICATION_KEY, application);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #6
Source File: ProviderServiceImpl.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private Pair<Long, URL> findProviderUrl(String service, String address) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
    filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    
    Map<Long, URL> ret = SyncUtils.filterFromCategory(getRegistryCache(), filter);
    if(ret.isEmpty()) {
        return null;
    }
    else { 
        Long key = ret.entrySet().iterator().next().getKey();
        return new Pair<Long, URL>(key, ret.get(key));
    }
}
 
Example #7
Source File: OverrideServiceImpl.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findOverrideUrl(String service, String address, String application) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONFIGURATORS_CATEGORY);
    if (service != null && service.length() > 0) {
    	filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    }
    if (address != null && address.length() > 0) {
    	filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    }
    if (application != null && application.length() > 0) {
    	filter.put(Constants.APPLICATION_KEY, application);
    }
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #8
Source File: RouteServiceImpl.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findRouteUrl(String service, String address, boolean force) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.ROUTERS_CATEGORY);
    if (service != null && service.length() > 0) {
    	filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    }
    if (address != null && address.length() > 0) {
    	filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    }
    if (force) {
    	filter.put("force", "true");
    }
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #9
Source File: ProviderServiceImpl.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private Pair<Long, URL> findProviderUrl(String service, String address) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
    filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    
    Map<Long, URL> ret = SyncUtils.filterFromCategory(getRegistryCache(), filter);
    if(ret.isEmpty()) {
        return null;
    }
    else { 
        Long key = ret.entrySet().iterator().next().getKey();
        return new Pair<Long, URL>(key, ret.get(key));
    }
}
 
Example #10
Source File: ConsumerServiceImpl.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public Map<Long, URL> findConsumerUrlByService(String service) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #11
Source File: ProviderServiceImpl.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findProviderUrlByService(String service) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
    filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #12
Source File: ConsumerServiceImpl.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findConsumerUrlByApplication(String application) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    filter.put(Constants.APPLICATION_KEY, application);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #13
Source File: ConsumerServiceImpl.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findConsumerUrlByAddress(String address) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #14
Source File: ConsumerServiceImpl.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public Map<Long, URL> findConsumerUrlByService(String service) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #15
Source File: RouteServiceImpl.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findRouteUrl(String service, String address, boolean force) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.ROUTERS_CATEGORY);
    if (service != null && service.length() > 0) {
    	filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    }
    if (address != null && address.length() > 0) {
    	filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    }
    if (force) {
    	filter.put("force", "true");
    }
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #16
Source File: OverrideServiceImpl.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findOverrideUrl(String service, String address, String application) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONFIGURATORS_CATEGORY);
    if (service != null && service.length() > 0) {
    	filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    }
    if (address != null && address.length() > 0) {
    	filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    }
    if (application != null && application.length() > 0) {
    	filter.put(Constants.APPLICATION_KEY, application);
    }
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #17
Source File: RouteServiceImpl.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findRouteUrl(String service, String address, boolean force) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.ROUTERS_CATEGORY);
    if (service != null && service.length() > 0) {
    	filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    }
    if (address != null && address.length() > 0) {
    	filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
    }
    if (force) {
    	filter.put("force", "true");
    }
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #18
Source File: ConsumerServiceImpl.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findConsumerUrlByApplication(String application) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    filter.put(Constants.APPLICATION_KEY, application);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #19
Source File: ProviderServiceImpl.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private Map<Long, URL> findProviderUrlByService(String service) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
    filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
    
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #20
Source File: OverrideServiceImpl.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public List<Override> findByServiceAndAddress(String service, String address) {
    return  SyncUtils.url2OverrideList(findOverrideUrl(service, address, null));
}
 
Example #21
Source File: RouteServiceImpl.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public Pair<Long, URL> findRouteUrlPair(Long id) {
    return SyncUtils.filterFromCategory(getRegistryCache(), Constants.ROUTERS_CATEGORY, id);
}
 
Example #22
Source File: OverrideServiceImpl.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
private Pair<Long, URL> findOverrideUrlPair(Long id) {
    return SyncUtils.filterFromCategory(getRegistryCache(), Constants.CONFIGURATORS_CATEGORY, id);
}
 
Example #23
Source File: RouteServiceImpl.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public List<Route> findAll() {
    return SyncUtils.url2RouteList(findAllUrl());
}
 
Example #24
Source File: RouteServiceImpl.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public List<Route> findAllForceRoute() {
    return SyncUtils.url2RouteList(findRouteUrl(null, null, true));
}
 
Example #25
Source File: OverrideServiceImpl.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public List<Override> findAll() {
    return SyncUtils.url2OverrideList(findOverrideUrl(null, null, null));
}
 
Example #26
Source File: OverrideServiceImpl.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public List<Override> findByServiceAndApplication(String service, String application) {
    return  SyncUtils.url2OverrideList(findOverrideUrl(service, null, application));
}
 
Example #27
Source File: ConsumerServiceImpl.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public List<Consumer> findByApplication(String application) {
    return SyncUtils.url2ConsumerList(findConsumerUrlByApplication(application));
}
 
Example #28
Source File: ProviderServiceImpl.java    From dubbox with Apache License 2.0 4 votes vote down vote up
private Map<Long, URL> findProviderUrlByApplication(String application) {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
    filter.put(Constants.APPLICATION_KEY, application);
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}
 
Example #29
Source File: ProviderServiceImpl.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public Provider findByServiceAndAddress(String service, String address) {
    return SyncUtils.url2Provider(findProviderUrl(service, address));
}
 
Example #30
Source File: ConsumerServiceImpl.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
private Map<Long, URL> findAllConsumerUrl() {
    Map<String, String> filter = new HashMap<String, String>();
    filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
    return SyncUtils.filterFromCategory(getRegistryCache(), filter);
}