本文整理汇总了Java中com.alibaba.dubbo.registry.support.AbstractRegistryFactory类的典型用法代码示例。如果您正苦于以下问题:Java AbstractRegistryFactory类的具体用法?Java AbstractRegistryFactory怎么用?Java AbstractRegistryFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractRegistryFactory类属于com.alibaba.dubbo.registry.support包,在下文中一共展示了AbstractRegistryFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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());
}
示例3: destroyAll
import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入依赖的package包/类
public static void destroyAll() {
if (!destroyed.compareAndSet(false, true)) {
return;
}
AbstractRegistryFactory.destroyAll();
for (String protocolName : ExtensionExtendUtil.getSupportedExtensions(Protocol.class)) {
try {
Protocol protocol = ExtensionExtendUtil.getExtension(Protocol.class, protocolName);
if (protocol != null) {
protocol.destroy();
}
} catch (Throwable t) {
log.warn(t.getMessage(), t);
}
}
}
示例4: 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);
}
示例5: 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());
}
}
示例6: destroyAll
import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入依赖的package包/类
public static void destroyAll() {
if (!destroyed.compareAndSet(false, true)) {
return;
}
AbstractRegistryFactory.destroyAll();
ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.class);
for (String protocolName : loader.getLoadedExtensions()) {
try {
Protocol protocol = loader.getLoadedExtension(protocolName);
if (protocol != null) {
protocol.destroy();
}
} catch (Throwable t) {
logger.warn(t.getMessage(), t);
}
}
}
示例7: destroyAll
import com.alibaba.dubbo.registry.support.AbstractRegistryFactory; //导入依赖的package包/类
public static void destroyAll() {
AbstractRegistryFactory.destroyAll();
ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.class);
for (String protocolName : loader.getLoadedExtensions()) {
try {
Protocol protocol = loader.getLoadedExtension(protocolName);
if (protocol != null) {
protocol.destroy();
}
} catch (Throwable t) {
logger.warn(t.getMessage(), t);
}
}
}
示例8: 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);
}
示例9: 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);
}