本文整理了Java中org.apache.dubbo.common.URL.getAddress()
方法的一些代码示例,展示了URL.getAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URL.getAddress()
方法的具体详情如下:
包路径:org.apache.dubbo.common.URL
类名称:URL
方法名:getAddress
暂无
代码示例来源:origin: apache/incubator-dubbo
@Override
public String getAddress() {
return super.getAddress();
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public String getAddress() {
return super.getAddress();
}
代码示例来源:origin: apache/incubator-dubbo
private boolean addressNotMatches(URL url, List<String> addresses) {
return addresses == null || !addresses.contains(url.getAddress());
}
代码示例来源:origin: apache/incubator-dubbo
private boolean addressMatches(URL url, List<String> addresses) {
return addresses != null && addresses.contains(url.getAddress());
}
代码示例来源:origin: apache/incubator-dubbo
private boolean addressMatches(URL url, List<String> addresses) {
return addresses != null && addresses.contains(url.getAddress());
}
代码示例来源:origin: apache/incubator-dubbo
private boolean addressNotMatches(URL url, List<String> addresses) {
return addresses == null || !addresses.contains(url.getAddress());
}
代码示例来源:origin: apache/incubator-dubbo
/**
* get all zookeeper urls (such as :zookeeper://127.0.0.1:2181?127.0.0.1:8989,127.0.0.1:9999)
*
* @param url such as:zookeeper://127.0.0.1:2181?127.0.0.1:8989,127.0.0.1:9999
* @return such as 127.0.0.1:2181,127.0.0.1:8989,127.0.0.1:9999
*/
List<String> getURLBackupAddress(URL url) {
List<String> addressList = new ArrayList<String>();
addressList.add(url.getAddress());
addressList.addAll(url.getParameter(Constants.BACKUP_KEY, Collections.EMPTY_LIST));
return addressList;
}
代码示例来源:origin: apache/incubator-dubbo
/**
* get all zookeeper urls (such as :zookeeper://127.0.0.1:2181?127.0.0.1:8989,127.0.0.1:9999)
*
* @param url such as:zookeeper://127.0.0.1:2181?127.0.0.1:8989,127.0.0.1:9999
* @return such as 127.0.0.1:2181,127.0.0.1:8989,127.0.0.1:9999
*/
List<String> getURLBackupAddress(URL url) {
List<String> addressList = new ArrayList<String>();
addressList.add(url.getAddress());
addressList.addAll(url.getParameter(Constants.BACKUP_KEY, Collections.EMPTY_LIST));
return addressList;
}
代码示例来源:origin: apache/incubator-dubbo
/**
* append thread name with url address
*
* @return new url with updated thread name
*/
public static URL setThreadName(URL url, String defaultName) {
String name = url.getParameter(Constants.THREAD_NAME_KEY, defaultName);
name = name + "-" + url.getAddress();
url = url.addParameter(Constants.THREAD_NAME_KEY, name);
return url;
}
代码示例来源:origin: apache/incubator-dubbo
private boolean isValidCategory(URL url) {
String category = url.getParameter(CATEGORY_KEY, DEFAULT_CATEGORY);
if ((ROUTERS_CATEGORY.equals(category) || ROUTE_PROTOCOL.equals(url.getProtocol())) ||
PROVIDERS_CATEGORY.equals(category) ||
CONFIGURATORS_CATEGORY.equals(category) || DYNAMIC_CONFIGURATORS_CATEGORY.equals(category) ||
APP_DYNAMIC_CONFIGURATORS_CATEGORY.equals(category)) {
return true;
}
logger.warn("Unsupported category " + category + " in notified url: " + url + " from registry " +
getUrl().getAddress() + " to consumer " + NetUtils.getLocalHost());
return false;
}
代码示例来源:origin: apache/incubator-dubbo
/**
* append thread name with url address
*
* @return new url with updated thread name
*/
public static URL setThreadName(URL url, String defaultName) {
String name = url.getParameter(Constants.THREAD_NAME_KEY, defaultName);
name = name + "-" + url.getAddress();
url = url.addParameter(Constants.THREAD_NAME_KEY, name);
return url;
}
代码示例来源:origin: apache/incubator-dubbo
private boolean isValidCategory(URL url) {
String category = url.getParameter(CATEGORY_KEY, DEFAULT_CATEGORY);
if ((ROUTERS_CATEGORY.equals(category) || ROUTE_PROTOCOL.equals(url.getProtocol())) ||
PROVIDERS_CATEGORY.equals(category) ||
CONFIGURATORS_CATEGORY.equals(category) || DYNAMIC_CONFIGURATORS_CATEGORY.equals(category) ||
APP_DYNAMIC_CONFIGURATORS_CATEGORY.equals(category)) {
return true;
}
logger.warn("Unsupported category " + category + " in notified url: " + url + " from registry " +
getUrl().getAddress() + " to consumer " + NetUtils.getLocalHost());
return false;
}
代码示例来源:origin: apache/incubator-dubbo
public String getBackupAddress(int defaultPort) {
StringBuilder address = new StringBuilder(appendDefaultPort(getAddress(), defaultPort));
String[] backups = getParameter(Constants.BACKUP_KEY, new String[0]);
if (ArrayUtils.isNotEmpty(backups)) {
for (String backup : backups) {
address.append(",");
address.append(appendDefaultPort(backup, defaultPort));
}
}
return address.toString();
}
代码示例来源:origin: apache/incubator-dubbo
public String getBackupAddress(int defaultPort) {
StringBuilder address = new StringBuilder(appendDefaultPort(getAddress(), defaultPort));
String[] backups = getParameter(Constants.BACKUP_KEY, new String[0]);
if (ArrayUtils.isNotEmpty(backups)) {
for (String backup : backups) {
address.append(",");
address.append(appendDefaultPort(backup, defaultPort));
}
}
return address.toString();
}
代码示例来源:origin: apache/incubator-dubbo
public Statistics(URL url) {
this.url = url;
this.application = url.getParameter(MonitorService.APPLICATION);
this.service = url.getParameter(MonitorService.INTERFACE);
this.method = url.getParameter(MonitorService.METHOD);
this.group = url.getParameter(MonitorService.GROUP);
this.version = url.getParameter(MonitorService.VERSION);
this.client = url.getParameter(MonitorService.CONSUMER, url.getAddress());
this.server = url.getParameter(MonitorService.PROVIDER, url.getAddress());
}
代码示例来源:origin: apache/incubator-dubbo
public Statistics(URL url) {
this.url = url;
this.application = url.getParameter(MonitorService.APPLICATION);
this.service = url.getParameter(MonitorService.INTERFACE);
this.method = url.getParameter(MonitorService.METHOD);
this.group = url.getParameter(MonitorService.GROUP);
this.version = url.getParameter(MonitorService.VERSION);
this.client = url.getParameter(MonitorService.CONSUMER, url.getAddress());
this.server = url.getParameter(MonitorService.PROVIDER, url.getAddress());
}
代码示例来源:origin: apache/incubator-dubbo
private LazyConnectExchangeClient replaceWithLazyClient() {
// this is a defensive operation to avoid client is closed by accident, the initial state of the client is false
URL lazyUrl = url.addParameter(Constants.LAZY_CONNECT_INITIAL_STATE_KEY, Boolean.FALSE)
.addParameter(Constants.RECONNECT_KEY, Boolean.FALSE)
.addParameter(Constants.SEND_RECONNECT_KEY, Boolean.TRUE.toString())
.addParameter("warning", Boolean.TRUE.toString())
.addParameter(LazyConnectExchangeClient.REQUEST_WITH_WARNING_KEY, true)
.addParameter("_client_memo", "referencecounthandler.replacewithlazyclient");
String key = url.getAddress();
// in worst case there's only one ghost connection.
LazyConnectExchangeClient gclient = ghostClientMap.get(key);
if (gclient == null || gclient.isClosed()) {
gclient = new LazyConnectExchangeClient(lazyUrl, client.getExchangeHandler());
ghostClientMap.put(key, gclient);
}
return gclient;
}
代码示例来源:origin: apache/incubator-dubbo
private LazyConnectExchangeClient replaceWithLazyClient() {
// this is a defensive operation to avoid client is closed by accident, the initial state of the client is false
URL lazyUrl = url.addParameter(Constants.LAZY_CONNECT_INITIAL_STATE_KEY, Boolean.FALSE)
.addParameter(Constants.RECONNECT_KEY, Boolean.FALSE)
.addParameter(Constants.SEND_RECONNECT_KEY, Boolean.TRUE.toString())
.addParameter("warning", Boolean.TRUE.toString())
.addParameter(LazyConnectExchangeClient.REQUEST_WITH_WARNING_KEY, true)
.addParameter("_client_memo", "referencecounthandler.replacewithlazyclient");
String key = url.getAddress();
// in worst case there's only one ghost connection.
LazyConnectExchangeClient gclient = ghostClientMap.get(key);
if (gclient == null || gclient.isClosed()) {
gclient = new LazyConnectExchangeClient(lazyUrl, client.getExchangeHandler());
ghostClientMap.put(key, gclient);
}
return gclient;
}
代码示例来源:origin: apache/incubator-dubbo
protected void checkInvokers(List<Invoker<T>> invokers, Invocation invocation) {
if (CollectionUtils.isEmpty(invokers)) {
throw new RpcException(RpcException.NO_INVOKER_AVAILABLE_AFTER_FILTER, "Failed to invoke the method "
+ invocation.getMethodName() + " in the service " + getInterface().getName()
+ ". No provider available for the service " + directory.getUrl().getServiceKey()
+ " from registry " + directory.getUrl().getAddress()
+ " on the consumer " + NetUtils.getLocalHost()
+ " using the dubbo version " + Version.getVersion()
+ ". Please check if the providers have been started and registered.");
}
}
代码示例来源:origin: apache/incubator-dubbo
protected void checkInvokers(List<Invoker<T>> invokers, Invocation invocation) {
if (CollectionUtils.isEmpty(invokers)) {
throw new RpcException(RpcException.NO_INVOKER_AVAILABLE_AFTER_FILTER, "Failed to invoke the method "
+ invocation.getMethodName() + " in the service " + getInterface().getName()
+ ". No provider available for the service " + directory.getUrl().getServiceKey()
+ " from registry " + directory.getUrl().getAddress()
+ " on the consumer " + NetUtils.getLocalHost()
+ " using the dubbo version " + Version.getVersion()
+ ". Please check if the providers have been started and registered.");
}
}
内容来源于网络,如有侵权,请联系作者删除!