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


Java ZookeeperTransporter类代码示例

本文整理汇总了Java中com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter的典型用法代码示例。如果您正苦于以下问题:Java ZookeeperTransporter类的具体用法?Java ZookeeperTransporter怎么用?Java ZookeeperTransporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ZookeeperTransporter类属于com.alibaba.dubbo.remoting.zookeeper包,在下文中一共展示了ZookeeperTransporter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ZookeeperRegistry

import com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter; //导入依赖的package包/类
public ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter) {
    super(url);
    if (url.isAnyHost()) {
		throw new IllegalStateException("registry address == null");
	}
    String group = url.getParameter(Constants.GROUP_KEY, DEFAULT_ROOT);
    if (! group.startsWith(Constants.PATH_SEPARATOR)) {
        group = Constants.PATH_SEPARATOR + group;
    }
    this.root = group;
    zkClient = zookeeperTransporter.connect(url);
    zkClient.addStateListener(new StateListener() {
        public void stateChanged(int state) {
        	if (state == RECONNECTED) {
         	try {
		recover();
	} catch (Exception e) {
		logger.error(e.getMessage(), e);
	}
        	}
        }
    });
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:24,代码来源:ZookeeperRegistry.java

示例2: ZookeeperRegistry

import com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter; //导入依赖的package包/类
public ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter) {
    super(url);
    if (url.isAnyHost()) {
        throw new IllegalStateException("registry address == null");
    }
    String group = url.getParameter(Constants.GROUP_KEY, DEFAULT_ROOT);
    if (!group.startsWith(Constants.PATH_SEPARATOR)) {
        group = Constants.PATH_SEPARATOR + group;
    }
    this.root = group;
    zkClient = zookeeperTransporter.connect(url);
    zkClient.addStateListener(new StateListener() {
        public void stateChanged(int state) {
            if (state == RECONNECTED) {
                try {
                    recover();
                } catch (Exception e) {
                    logger.error(e.getMessage(), e);
                }
            }
        }
    });
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:24,代码来源:ZookeeperRegistry.java

示例3: ZookeeperRegistry

import com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter; //导入依赖的package包/类
public ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter) {
    super(url);
    if (url.isAnyHost()) {
        throw new IllegalStateException("registry address == null");
    }
    String group = url.getParameter(Constants.GROUP_KEY, DEFAULT_ROOT);
    if (!group.startsWith(Constants.PATH_SEPARATOR)) {
        group = Constants.PATH_SEPARATOR + group;
    }
    this.root = group;
    zkClient = zookeeperTransporter.connect(url);
    zkClient.addStateListener(state -> {
        if (state == StateListener.RECONNECTED) {
            try {
                recover();
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
    });
}
 
开发者ID:linux-china,项目名称:dubbo3,代码行数:22,代码来源:ZookeeperRegistry.java

示例4: ZookeeperRegistry

import com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter; //导入依赖的package包/类
public ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter) {
    super(url);
    /*if (url.isAnyHost()) {
		throw new IllegalStateException("registry address == null");
	}*/
    String group = url.getParameter(Constants.GROUP_KEY, DEFAULT_ROOT);
    if (! group.startsWith(Constants.PATH_SEPARATOR)) {
        group = Constants.PATH_SEPARATOR + group;
    }
    this.root = group;
    zkClient = zookeeperTransporter.connect(url);
    //主要处理Session失效之后重连的逻辑
    zkClient.addStateListener(new StateListener() {
        public void stateChanged(int state) {
        	if (state == RECONNECTED) {
         	try {
		recover();
	} catch (Exception e) {
		logger.error(e.getMessage(), e);
	}
        	}
        }
    });
}
 
开发者ID:DoubleSmile,项目名称:dubbo-learning,代码行数:25,代码来源:ZookeeperRegistry.java

示例5: ZookeeperRegistry

import com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter; //导入依赖的package包/类
public ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter) {
    super(url);
    if (url.isAnyHost()) {
		throw new IllegalStateException("registry address == null");
	}

    // 这里获取在dubbo:registry的group配置
    String group = url.getParameter(Constants.GROUP_KEY, DEFAULT_ROOT);

    // 如果group没有以/开头,则给他加上
    if (! group.startsWith(Constants.PATH_SEPARATOR)) {
        group = Constants.PATH_SEPARATOR + group;
    }
    this.root = group;
    zkClient = zookeeperTransporter.connect(url);//连接上zk服务器上
    zkClient.addStateListener(new StateListener() {// 增加绑定在连接上的状态变更监听器,如果RECONNECTED,则恢复连接
        public void stateChanged(int state) {
        	if (state == RECONNECTED) {
         	try {
		recover();
	} catch (Exception e) {
		logger.error(e.getMessage(), e);
	}
        	}
        }
    });
}
 
开发者ID:ketao1989,项目名称:exDubbo,代码行数:28,代码来源:ZookeeperRegistry.java

示例6: setZookeeperTransporter

import com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter; //导入依赖的package包/类
public void setZookeeperTransporter(ZookeeperTransporter zookeeperTransporter) {
	this.zookeeperTransporter = zookeeperTransporter;
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:4,代码来源:ZookeeperRegistryFactory.java

示例7: setZookeeperTransporter

import com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter; //导入依赖的package包/类
public void setZookeeperTransporter(ZookeeperTransporter zookeeperTransporter) {
    this.zookeeperTransporter = zookeeperTransporter;
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:4,代码来源:ZookeeperRegistryFactory.java


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