- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.createPersistent()
方法的一些代码示例,展示了ZkClientx.createPersistent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkClientx.createPersistent()
方法的具体详情如下:
包路径:com.alibaba.otter.canal.common.zookeeper.ZkClientx
类名称:ZkClientx
方法名:createPersistent
[英]Create a persistent Sequential node.
[中]创建一个持久的顺序节点。
代码示例来源:origin: alibaba/canal
/**
* Create a persistent Sequential node.
*
* @param path
* @param createParents if true all parent dirs are created as well and no
* {@link ZkNodeExistsException} is thrown in case the path already exists
* @throws ZkInterruptedException if operation was interrupted, or a
* required reconnection got interrupted
* @throws IllegalArgumentException if called from anything except the
* ZooKeeper event thread
* @throws ZkException if any ZooKeeper exception occurred
* @throws RuntimeException if any other exception occurs
*/
public String createPersistentSequential(String path, boolean createParents) throws ZkInterruptedException,
IllegalArgumentException, ZkException,
RuntimeException {
try {
return create(path, null, CreateMode.PERSISTENT_SEQUENTIAL);
} catch (ZkNoNodeException e) {
if (!createParents) {
throw e;
}
String parentDir = path.substring(0, path.lastIndexOf('/'));
createPersistent(parentDir, createParents);
return createPersistentSequential(path, createParents);
}
}
代码示例来源:origin: alibaba/canal
createPersistent(parentDir, createParents);
createPersistent(path, data, createParents);
代码示例来源:origin: alibaba/canal
private void initCid(String path) {
// logger.info("## init the canalId = {}", cid);
// 初始化系统目录
if (zkclientx != null) {
try {
zkclientx.createEphemeral(path);
} catch (ZkNoNodeException e) {
// 如果父目录不存在,则创建
String parentDir = path.substring(0, path.lastIndexOf('/'));
zkclientx.createPersistent(parentDir, true);
zkclientx.createEphemeral(path);
} catch (ZkNodeExistsException e) {
// ignore
// 因为第一次启动时创建了cid,但在stop/start的时可能会关闭和新建,允许出现NodeExists问题s
}
}
}
代码示例来源:origin: alibaba/canal
/**
* Create a persistent Sequential node.
*
* @param path
* @param data
* @param createParents if true all parent dirs are created as well and no
* {@link ZkNodeExistsException} is thrown in case the path already exists
* @throws ZkInterruptedException if operation was interrupted, or a
* required reconnection got interrupted
* @throws IllegalArgumentException if called from anything except the
* ZooKeeper event thread
* @throws ZkException if any ZooKeeper exception occurred
* @throws RuntimeException if any other exception occurs
*/
public String createPersistentSequential(String path, Object data, boolean createParents)
throws ZkInterruptedException,
IllegalArgumentException,
ZkException,
RuntimeException {
try {
return create(path, data, CreateMode.PERSISTENT_SEQUENTIAL);
} catch (ZkNoNodeException e) {
if (!createParents) {
throw e;
}
String parentDir = path.substring(0, path.lastIndexOf('/'));
createPersistent(parentDir, createParents);
return createPersistentSequential(path, data, createParents);
}
}
代码示例来源:origin: alibaba/canal
@Override
public void persistLogPosition(String destination, LogPosition logPosition) throws CanalParseException {
String path = ZookeeperPathUtils.getParsePath(destination);
byte[] data = JsonUtils.marshalToByte(logPosition);
try {
zkClientx.writeData(path, data);
} catch (ZkNoNodeException e) {
zkClientx.createPersistent(path, data, true);
}
}
代码示例来源:origin: alibaba/canal
public void addBatch(ClientIdentity clientIdentity, PositionRange positionRange,
Long batchId) throws CanalMetaManagerException {
String path = ZookeeperPathUtils
.getBatchMarkWithIdPath(clientIdentity.getDestination(), clientIdentity.getClientId(), batchId);
byte[] data = JsonUtils.marshalToByte(positionRange, SerializerFeature.WriteClassName);
zkClientx.createPersistent(path, data, true);
}
代码示例来源:origin: alibaba/canal
public void updateCursor(ClientIdentity clientIdentity, Position position) throws CanalMetaManagerException {
String path = ZookeeperPathUtils.getCursorPath(clientIdentity.getDestination(), clientIdentity.getClientId());
byte[] data = JsonUtils.marshalToByte(position, SerializerFeature.WriteClassName);
try {
zkClientx.writeData(path, data);
} catch (ZkNoNodeException e) {
zkClientx.createPersistent(path, data, true);// 第一次节点不存在,则尝试重建
}
}
代码示例来源:origin: alibaba/canal
public void subscribe(ClientIdentity clientIdentity) throws CanalMetaManagerException {
String path = ZookeeperPathUtils.getClientIdNodePath(clientIdentity.getDestination(),
clientIdentity.getClientId());
try {
zkClientx.createPersistent(path, true);
} catch (ZkNodeExistsException e) {
// ignore
}
if (clientIdentity.hasFilter()) {
String filterPath = ZookeeperPathUtils.getFilterPath(clientIdentity.getDestination(),
clientIdentity.getClientId());
byte[] bytes = null;
try {
bytes = clientIdentity.getFilter().getBytes(ENCODE);
} catch (UnsupportedEncodingException e) {
throw new CanalMetaManagerException(e);
}
try {
zkClientx.createPersistent(filterPath, bytes);
} catch (ZkNodeExistsException e) {
// ignore
zkClientx.writeData(filterPath, bytes);
}
}
}
代码示例来源:origin: alibaba/canal
zkclientx = ZkClientx.getZkClient(zkServers);
zkclientx.createPersistent(ZookeeperPathUtils.DESTINATION_ROOT_NODE, true);
zkclientx.createPersistent(ZookeeperPathUtils.CANAL_CLUSTER_ROOT_NODE, true);
代码示例来源:origin: alibaba/canal
zkClient.createPersistent(ZookeeperPathUtils.getClientIdNodePath(this.destination, clientData.getClientId()),
true); // 尝试创建父节点
initRunning();
代码示例来源:origin: alibaba/canal
private void initRunning() {
if (!isStart()) {
return;
}
String path = ZookeeperPathUtils.getDestinationServerRunning(destination);
// 序列化
byte[] bytes = JsonUtils.marshalToByte(serverData);
try {
mutex.set(false);
zkClient.create(path, bytes, CreateMode.EPHEMERAL);
activeData = serverData;
processActiveEnter();// 触发一下事件
mutex.set(true);
} catch (ZkNodeExistsException e) {
bytes = zkClient.readData(path, true);
if (bytes == null) {// 如果不存在节点,立即尝试一次
initRunning();
} else {
activeData = JsonUtils.unmarshalFromByte(bytes, ServerRunningData.class);
}
} catch (ZkNoNodeException e) {
zkClient.createPersistent(ZookeeperPathUtils.getDestinationPath(destination), true); // 尝试创建父节点
initRunning();
}
}
代码示例来源:origin: com.alibaba.otter/canal.deployer
private void initCid(String path) {
// logger.info("## init the canalId = {}", cid);
// 初始化系统目录
if (zkclientx != null) {
try {
zkclientx.createEphemeral(path);
} catch (ZkNoNodeException e) {
// 如果父目录不存在,则创建
String parentDir = path.substring(0, path.lastIndexOf('/'));
zkclientx.createPersistent(parentDir, true);
zkclientx.createEphemeral(path);
} catch (ZkNodeExistsException e) {
// ignore
// 因为第一次启动时创建了cid,但在stop/start的时可能会关闭和新建,允许出现NodeExists问题s
}
}
}
代码示例来源:origin: com.alibaba.otter/canal.deployer
zkclientx = ZkClientx.getZkClient(zkServers);
zkclientx.createPersistent(ZookeeperPathUtils.DESTINATION_ROOT_NODE, true);
zkclientx.createPersistent(ZookeeperPathUtils.CANAL_CLUSTER_ROOT_NODE, true);
代码示例来源:origin: com.alibaba.otter/canal.client
zkClient.createPersistent(ZookeeperPathUtils.getClientIdNodePath(this.destination, clientData.getClientId()),
true); // 尝试创建父节点
initRunning();
Canal是阿里巴巴旗下的一款开源项目,利用Java开发。主要用途是基于MySQL数据库增量日志解析,提供增量数据订阅和消费,目前主要支持MySQL。 GitHub地址:https://githu
目录 1.1. 开启 MySQL 的 binlog 日志 1.2. 配置 rabbitmq Exchanges 和 Queues 1.3. 安装单机 canal
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx类的一些代码示例,展示了ZkClientx类的具体用法。这些代码示例主要来源于G
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZookeeperPathUtils类的一些代码示例,展示了ZookeeperPathUtils类
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.readData()方法的一些代码示例,展示了ZkClientx.readDa
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.unsubscribeDataChanges()方法的一些代码示例,展示了Zk
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.getChildren()方法的一些代码示例,展示了ZkClientx.get
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.writeData()方法的一些代码示例,展示了ZkClientx.write
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.delete()方法的一些代码示例,展示了ZkClientx.delete()
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.subscribeDataChanges()方法的一些代码示例,展示了ZkCl
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.createPersistent()方法的一些代码示例,展示了ZkClient
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.createPersistentSequential()方法的一些代码示例,展
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.create()方法的一些代码示例,展示了ZkClientx.create()
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZkClientx.getZkClient()方法的一些代码示例,展示了ZkClientx.get
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZookeeperPathUtils.getDestinationServerRunning()方
本文整理了Java中com.alibaba.otter.canal.common.zookeeper.ZookeeperPathUtils.getDestinationPath()方法的一些代码示例,
我是一名优秀的程序员,十分优秀!