Java Code Examples for com.alibaba.dubbo.registry.Registry#isAvailable()
The following examples show how to use
com.alibaba.dubbo.registry.Registry#isAvailable() .
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: RegistryStatusChecker.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override public Status check() { Collection<Registry> registries = AbstractRegistryFactory.getRegistries(); if (registries.isEmpty()) { return new Status(Status.Level.UNKNOWN); } Status.Level level = Status.Level.OK; StringBuilder buf = new StringBuilder(); for (Registry registry : registries) { 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()); }
Example 2
Source File: RegistryStatusChecker.java From dubbox with Apache License 2.0 | 6 votes |
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()); }
Example 3
Source File: RegistryStatusChecker.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
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()); }
Example 4
Source File: RegistryStatusChecker.java From dubbo3 with Apache License 2.0 | 6 votes |
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()); }
Example 5
Source File: RegistryStatusChecker.java From dubbox with Apache License 2.0 | 6 votes |
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()); }
Example 6
Source File: DubboRegistryStatusHealthCheck.java From watcher with Apache License 2.0 | 6 votes |
@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()); } }
Example 7
Source File: RegistryStatusChecker.java From dubbox with Apache License 2.0 | 6 votes |
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()); }
Example 8
Source File: RegistriesPageHandler.java From dubbox with Apache License 2.0 | 5 votes |
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); }
Example 9
Source File: RegistriesPageHandler.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
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); }
Example 10
Source File: RegistriesPageHandler.java From dubbo3 with Apache License 2.0 | 5 votes |
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); }
Example 11
Source File: RegistriesPageHandler.java From dubbox with Apache License 2.0 | 5 votes |
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); }
Example 12
Source File: RegistriesPageHandler.java From dubbox with Apache License 2.0 | 5 votes |
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); }