Search in sources :

Example 1 with MotanErrorMsg

use of com.weibo.api.motan.exception.MotanErrorMsg in project motan by weibocom.

the class SimpleConfigHandler method register.

private void register(List<URL> registryUrls, URL serviceUrl) {
    for (URL url : registryUrls) {
        // 根据check参数的设置,register失败可能会抛异常,上层应该知晓
        RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getExtension(url.getProtocol());
        if (registryFactory == null) {
            throw new MotanFrameworkException(new MotanErrorMsg(500, MotanErrorMsgConstant.FRAMEWORK_REGISTER_ERROR_CODE, "register error! Could not find extension for registry protocol:" + url.getProtocol() + ", make sure registry module for " + url.getProtocol() + " is in classpath!"));
        }
        Registry registry = registryFactory.getRegistry(url);
        registry.register(serviceUrl);
    }
}
Also used : RegistryFactory(com.weibo.api.motan.registry.RegistryFactory) MotanFrameworkException(com.weibo.api.motan.exception.MotanFrameworkException) MotanErrorMsg(com.weibo.api.motan.exception.MotanErrorMsg) Registry(com.weibo.api.motan.registry.Registry)

Aggregations

MotanErrorMsg (com.weibo.api.motan.exception.MotanErrorMsg)1 MotanFrameworkException (com.weibo.api.motan.exception.MotanFrameworkException)1 Registry (com.weibo.api.motan.registry.Registry)1 RegistryFactory (com.weibo.api.motan.registry.RegistryFactory)1