当前位置: 首页>>代码示例>>Java>>正文


Java AbstractRegistryFactory.getRegistries方法代码示例

本文整理汇总了Java中com.alibaba.dubbo.registry.support.AbstractRegistryFactory.getRegistries方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractRegistryFactory.getRegistries方法的具体用法?Java AbstractRegistryFactory.getRegistries怎么用?Java AbstractRegistryFactory.getRegistries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.dubbo.registry.support.AbstractRegistryFactory的用法示例。


在下文中一共展示了AbstractRegistryFactory.getRegistries方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: check

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
public Status check() {
    Collection<Registry> regsitries = AbstractRegistryFactory.getRegistries();
    if (regsitries == null || regsitries.size() == 0) {
        return new Status(Status.Level.UNKNOWN);
    }
    Status.Level level = Status.Level.OK;
    StringBuilder buf = new StringBuilder();
    for (Registry registry : regsitries) {
        if (buf.length() > 0) {
            buf.append(",");
        }
        buf.append(registry.getUrl().getAddress());
        if (! registry.isAvailable()) {
            level = Status.Level.ERROR;
            buf.append("(disconnected)");
        } else {
            buf.append("(connected)");
        }
    }
    return new Status(level, buf.toString());
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:22,代码来源:RegistryStatusChecker.java

示例2: check

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
public Status check() {
    Collection<Registry> regsitries = AbstractRegistryFactory.getRegistries();
    if (regsitries == null || regsitries.size() == 0) {
        return new Status(Status.Level.UNKNOWN);
    }
    Status.Level level = Status.Level.OK;
    StringBuilder buf = new StringBuilder();
    for (Registry registry : regsitries) {
        if (buf.length() > 0) {
            buf.append(",");
        }
        buf.append(registry.getUrl().getAddress());
        if (!registry.isAvailable()) {
            level = Status.Level.ERROR;
            buf.append("(disconnected)");
        } else {
            buf.append("(connected)");
        }
    }
    return new Status(level, buf.toString());
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:22,代码来源:RegistryStatusChecker.java

示例3: getTracingCollector

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
@Override
public TracingCollector getTracingCollector() {
    Collection<Registry> registries =  AbstractRegistryFactory.getRegistries();
    List<URL> urls = new ArrayList<URL>();
    for(Registry registry:registries){
        URL url = registry.getUrl();
        String protocolName = url.getProtocol();
        url=url.setProtocol(Constants.REGISTRY_PROTOCOL);
        url=url.addParameter(Constants.REGISTRY_KEY,protocolName);
        url=url.setPath(TracingCollector.class.getName());
        url=url.addParameter(Constants.INTERFACE_KEY,TracingCollector.class.getName());
        url=url.addParameter(Constants.REFERENCE_FILTER_KEY,"-dst");
        urls.add(url);
    }
    return createTracingCollector(urls);
}
 
开发者ID:dubboclub,项目名称:dubbo-plus,代码行数:17,代码来源:AbstractTracingCollectorFactory.java

示例4: check

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
@Override
protected Result check() throws Exception {
	Collection<Registry> regsitries = AbstractRegistryFactory.getRegistries();
	if (regsitries.size() == 0) {
		return Result.healthy("no registry found");
	}
	boolean isOK = true;
	StringBuilder buf = new StringBuilder();
	for (Registry registry : regsitries) {
		if (buf.length() > 0) {
			buf.append(",");
		}
		buf.append(registry.getUrl().getAddress());
		if (!registry.isAvailable()) {
			isOK = false;
			buf.append("(disconnected)");
		} else {
			buf.append("(connected)");
		}
	}
	if (isOK) {
		return Result.healthy();
	} else {
		return Result.unhealthy(buf.toString());
	}
}
 
开发者ID:cqyijifu,项目名称:watcher,代码行数:27,代码来源:DubboRegistryStatusHealthCheck.java

示例5: handle

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
public Page handle(URL url) {
    List<List<String>> rows = new ArrayList<List<String>>();
    Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
    int registeredCount = 0;
    int subscribedCount = 0;
    if (registries != null && registries.size() > 0) {
        for (Registry registry : registries) {
            String server = registry.getUrl().getAddress();
            List<String> row = new ArrayList<String>();
            row.add(NetUtils.getHostName(server) + "/" + server);
            if (registry.isAvailable()) {
                row.add("<font color=\"green\">Connected</font>");
            } else {
                row.add("<font color=\"red\">Disconnected</font>");
            }
            int registeredSize = 0;
            int subscribedSize = 0;
            if (registry instanceof AbstractRegistry) {
                registeredSize = ((AbstractRegistry) registry).getRegistered().size();
                registeredCount += registeredSize;
                subscribedSize = ((AbstractRegistry) registry).getSubscribed().size();
                subscribedCount += subscribedSize;
            }
            row.add("<a href=\"registered.html?registry=" + server + "\">Registered(" + registeredSize + ")</a>");
            row.add("<a href=\"subscribed.html?registry=" + server + "\">Subscribed(" + subscribedSize + ")</a>");
            rows.add(row);
        }
    }
    return new Page("Registries", "Registries (" + rows.size() + ")",
            new String[] { "Registry Address:", "Status", "Registered(" + registeredCount + ")", "Subscribed(" + subscribedCount + ")" }, rows);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:32,代码来源:RegistriesPageHandler.java

示例6: handle

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
public Page handle(URL url) {
    List<List<String>> rows = new ArrayList<List<String>>();
    Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
    int registeredCount = 0;
    int subscribedCount = 0;
    if (registries != null && registries.size() > 0) {
        for (Registry registry : registries) {
            String server = registry.getUrl().getAddress();
            List<String> row = new ArrayList<String>();
            row.add(NetUtils.getHostName(server) + "/" + server);
            if (registry.isAvailable()) {
                row.add("<font color=\"green\">Connected</font>");
            } else {
                row.add("<font color=\"red\">Disconnected</font>");
            }
            int registeredSize = 0;
            int subscribedSize = 0;
            if (registry instanceof AbstractRegistry) {
                registeredSize = ((AbstractRegistry) registry).getRegistered().size();
                registeredCount += registeredSize;
                subscribedSize = ((AbstractRegistry) registry).getSubscribed().size();
                subscribedCount += subscribedSize;
            }
            row.add("<a href=\"registered.html?registry=" + server + "\">Registered(" + registeredSize + ")</a>");
            row.add("<a href=\"subscribed.html?registry=" + server + "\">Subscribed(" + subscribedSize + ")</a>");
            rows.add(row);
        }
    }
    return new Page("Registries", "Registries (" + rows.size() + ")",
            new String[]{"Registry Address:", "Status", "Registered(" + registeredCount + ")", "Subscribed(" + subscribedCount + ")"}, rows);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:32,代码来源:RegistriesPageHandler.java

示例7: registered

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
@RequestMapping(value = "/registered", method = RequestMethod.GET)
public String registered(@RequestParam String registry, Model model) {
    Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
    Registry reg = null;
    if (registries.size() > 0) {
        for (Registry r : registries) {
            String sp = r.getUrl().getAddress();
            if (((registry == null || registry.length() == 0) && reg == null) || sp.equals(registry)) {
                reg = r;
            }
        }
    }

    List<String> rows = new ArrayList<String>();

    if (reg instanceof AbstractRegistry) {
        Set<URL> services = ((AbstractRegistry) reg).getRegistered();
        if (services != null && services.size() > 0) {
            for (URL u : services) {
                rows.add(u.toFullString());
            }
        }
    }

    model.addAttribute("registry", registry);
    model.addAttribute("rows", rows);
    return "registry/registered";
}
 
开发者ID:KevinMyDing,项目名称:LetUsGo-Server,代码行数:29,代码来源:RegistriesController.java

示例8: doMonitor

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
@Override
public Object doMonitor(Map<String, Object> params) throws Throwable {
	Map<String, Object> result = Maps.newHashMap();
	
	Collection<Registry> regsitries = AbstractRegistryFactory.getRegistries();
	if (regsitries.size() == 0) {
		throw WatcherException.throwIt("no registry found");
	}
	for (Registry registry : regsitries) {
		result.put(registry.getUrl().getAddress(), registry.isAvailable());
	}
	return result;
}
 
开发者ID:cqyijifu,项目名称:watcher,代码行数:14,代码来源:DubboRegistryStatusMetrics.java

示例9: handle

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
public Page handle(URL url) {
    String registryAddress = url.getParameter("registry", "");
    List<List<String>> rows = new ArrayList<List<String>>();
    Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
    StringBuilder select = new StringBuilder();
    Registry registry = null;
    if (registries != null && registries.size() > 0) {
        if (registries.size() == 1) {
            registry = registries.iterator().next();
            select.append(" &gt; " + registry.getUrl().getAddress());
        } else {
            select.append(" &gt; <select onchange=\"window.location.href='subscribed.html?registry=' + this.value;\">");
            for (Registry r : registries) {
                String sp = r.getUrl().getAddress();
                select.append("<option value=\">");
                select.append(sp);
                if (((registryAddress == null || registryAddress.length() == 0) && registry == null)
                        || registryAddress.equals(sp)) {
                    registry = r;
                    select.append("\" selected=\"selected");
                }
                select.append("\">");
                select.append(sp);
                select.append("</option>");
            }
            select.append("</select>");
        }
    }
    if (registry instanceof AbstractRegistry) {
        Set<URL> services = ((AbstractRegistry) registry).getSubscribed().keySet();
        if (services != null && services.size() > 0) {
            for (URL u : services) {
                List<String> row = new ArrayList<String>();
                row.add(u.toFullString().replace("<", "&lt;").replace(">", "&gt;"));
                rows.add(row);
            }
        }
    }
    return new Page("<a href=\"registries.html\">Registries</a>" + select.toString() + " &gt; <a href=\"registered.html?registry=" + registryAddress + "\">Registered</a> | Subscribed", "Subscribed (" + rows.size() + ")",
            new String[] { "Consumer URL:" }, rows);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:42,代码来源:SubscribedPageHandler.java

示例10: handle

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
public Page handle(URL url) {
    String registryAddress = url.getParameter("registry", "");
    List<List<String>> rows = new ArrayList<List<String>>();
    Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
    StringBuilder select = new StringBuilder();
    Registry registry = null;
    if (registries != null && registries.size() > 0) {
        if (registries.size() == 1) {
            registry = registries.iterator().next();
            select.append(" &gt; " + registry.getUrl().getAddress());
        } else {
            select.append(" &gt; <select onchange=\"window.location.href='registered.html?registry=' + this.value;\">");
            for (Registry r : registries) {
                String sp = r.getUrl().getAddress();
                select.append("<option value=\">");
                select.append(sp);
                if (((registryAddress == null || registryAddress.length() == 0) && registry == null)
                        || registryAddress.equals(sp)) {
                    registry = r;
                    select.append("\" selected=\"selected");
                }
                select.append("\">");
                select.append(sp);
                select.append("</option>");
            }
            select.append("</select>");
        }
    }
    if (registry instanceof AbstractRegistry) {
        Set<URL> services = ((AbstractRegistry) registry).getRegistered();
        if (services != null && services.size() > 0) {
            for (URL u : services) {
                List<String> row = new ArrayList<String>();
                row.add(u.toFullString().replace("<", "&lt;").replace(">", "&gt;"));
                rows.add(row);
            }
        }
    }
    return new Page("<a href=\"registries.html\">Registries</a>" + select.toString() + " &gt; Registered | <a href=\"subscribed.html?registry=" + registryAddress + "\">Subscribed</a>", "Registered (" + rows.size() + ")",
            new String[] { "Provider URL:" }, rows);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:42,代码来源:RegisteredPageHandler.java

示例11: handle

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
public Page handle(URL url) {
    String registryAddress = url.getParameter("registry", "");
    List<List<String>> rows = new ArrayList<List<String>>();
    Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
    StringBuilder select = new StringBuilder();
    Registry registry = null;
    if (registries != null && registries.size() > 0) {
        if (registries.size() == 1) {
            registry = registries.iterator().next();
            select.append(" &gt; " + registry.getUrl().getAddress());
        } else {
            select.append(" &gt; <select onchange=\"window.location.href='subscribed.html?registry=' + this.value;\">");
            for (Registry r : registries) {
                String sp = r.getUrl().getAddress();
                select.append("<option value=\">");
                select.append(sp);
                if (((registryAddress == null || registryAddress.length() == 0) && registry == null)
                        || registryAddress.equals(sp)) {
                    registry = r;
                    select.append("\" selected=\"selected");
                }
                select.append("\">");
                select.append(sp);
                select.append("</option>");
            }
            select.append("</select>");
        }
    }
    if (registry instanceof AbstractRegistry) {
        Set<URL> services = ((AbstractRegistry) registry).getSubscribed().keySet();
        if (services != null && services.size() > 0) {
            for (URL u : services) {
                List<String> row = new ArrayList<String>();
                row.add(u.toFullString().replace("<", "&lt;").replace(">", "&gt;"));
                rows.add(row);
            }
        }
    }
    return new Page("<a href=\"registries.html\">Registries</a>" + select.toString() + " &gt; <a href=\"registered.html?registry=" + registryAddress + "\">Registered</a> | Subscribed", "Subscribed (" + rows.size() + ")",
            new String[]{"Consumer URL:"}, rows);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:42,代码来源:SubscribedPageHandler.java

示例12: handle

import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入方法依赖的package包/类
public Page handle(URL url) {
    String registryAddress = url.getParameter("registry", "");
    List<List<String>> rows = new ArrayList<List<String>>();
    Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
    StringBuilder select = new StringBuilder();
    Registry registry = null;
    if (registries != null && registries.size() > 0) {
        if (registries.size() == 1) {
            registry = registries.iterator().next();
            select.append(" &gt; " + registry.getUrl().getAddress());
        } else {
            select.append(" &gt; <select onchange=\"window.location.href='registered.html?registry=' + this.value;\">");
            for (Registry r : registries) {
                String sp = r.getUrl().getAddress();
                select.append("<option value=\">");
                select.append(sp);
                if (((registryAddress == null || registryAddress.length() == 0) && registry == null)
                        || registryAddress.equals(sp)) {
                    registry = r;
                    select.append("\" selected=\"selected");
                }
                select.append("\">");
                select.append(sp);
                select.append("</option>");
            }
            select.append("</select>");
        }
    }
    if (registry instanceof AbstractRegistry) {
        Set<URL> services = ((AbstractRegistry) registry).getRegistered();
        if (services != null && services.size() > 0) {
            for (URL u : services) {
                List<String> row = new ArrayList<String>();
                row.add(u.toFullString().replace("<", "&lt;").replace(">", "&gt;"));
                rows.add(row);
            }
        }
    }
    return new Page("<a href=\"registries.html\">Registries</a>" + select.toString() + " &gt; Registered | <a href=\"subscribed.html?registry=" + registryAddress + "\">Subscribed</a>", "Registered (" + rows.size() + ")",
            new String[]{"Provider URL:"}, rows);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:42,代码来源:RegisteredPageHandler.java


注:本文中的com.alibaba.dubbo.registry.support.AbstractRegistryFactory.getRegistries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。