org.I0Itec.zkclient.exception.ZkException.getMessage()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.I0Itec.zkclient.exception.ZkException.getMessage()方法的一些代码示例,展示了ZkException.getMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkException.getMessage()方法的具体详情如下:
包路径:org.I0Itec.zkclient.exception.ZkException
类名称:ZkException
方法名:getMessage

ZkException.getMessage介绍

暂无

代码示例

代码示例来源:origin: weibocom/motan

@Override
protected Registry createRegistry(URL registryUrl) {
  try {
    int timeout = registryUrl.getIntParameter(URLParamType.connectTimeout.getName(), URLParamType.connectTimeout.getIntValue());
    int sessionTimeout = registryUrl.getIntParameter(URLParamType.registrySessionTimeout.getName(), URLParamType.registrySessionTimeout.getIntValue());
    ZkClient zkClient = createInnerZkClient(registryUrl.getParameter("address"), sessionTimeout, timeout);
    return new ZookeeperRegistry(registryUrl, zkClient);
  } catch (ZkException e) {
    LoggerUtil.error("[ZookeeperRegistry] fail to connect zookeeper, cause: " + e.getMessage());
    throw e;
  }
}

代码示例来源:origin: apache/helix

/**
 * Sync remove. it tries to remove the ZNode and all its descendants if any, node does not exist
 * is regarded as success
 */
@Override
public boolean remove(String path, int options) {
 try {
  // operation will not throw exception  when path successfully deleted or does not exist
  // despite real error, operation will throw exception when path not empty, and in this
  // case, we try to delete recursively
  _zkClient.delete(path);
 } catch (ZkException e) {
  LOG.debug("Failed to delete {} with opts {}, err: {}. Try recursive delete", path, options,
    e.getMessage());
  try {
   _zkClient.deleteRecursively(path);
  } catch (HelixException he) {
   LOG.error("Failed to delete {} recursively with opts {}.", path, options, he);
   return false;
  }
 }
 return true;
}

代码示例来源:origin: com.alibaba.otter/shared.arbitrate

/**
 * <pre>
 * 算法:
 * 1. 创建对应的transformed节点,标志transform已完成
 * </pre>
 * 
 * @param pipelineId 同步流id
 */
public void single(EtlEventData data) {
  Assert.notNull(data);
  String path = StagePathUtils.getTransformStage(data.getPipelineId(), data.getProcessId());
  data.setCurrNid(ArbitrateConfigUtils.getCurrentNid());
  // 序列化
  byte[] bytes = JsonUtils.marshalToByte(data, SerializerFeature.WriteClassName);
  try {
    zookeeper.create(path, bytes, CreateMode.PERSISTENT);
  } catch (ZkNoNodeException e) {
    // process节点不存在,出现了rollback/shutdown操作,直接忽略
    logger.warn("pipelineId[{}] transform ignore processId[{}] single by data:{}",
          new Object[] { data.getPipelineId(), data.getProcessId(), data });
  } catch (ZkNodeExistsException e) {
    // process节点已存在,出现了ConnectionLoss retry操作
    logger.warn("pipelineId[{}] transform ignore processId[{}] single by data:{}",
          new Object[] { data.getPipelineId(), data.getProcessId(), data });
  } catch (ZkException e) {
    throw new ArbitrateException("transform_single", e.getMessage(), e);
  }
}

代码示例来源:origin: com.alibaba.otter/shared.arbitrate

/**
 * <pre>
 * 算法:
 * 1. 创建对应的extracted节点,标志extract已完成
 * </pre>
 * 
 * @param pipelineId 同步流id
 */
public void single(EtlEventData data) {
  Assert.notNull(data);
  String path = StagePathUtils.getExtractStage(data.getPipelineId(), data.getProcessId());
  data.setCurrNid(ArbitrateConfigUtils.getCurrentNid());
  // 序列化
  byte[] bytes = JsonUtils.marshalToByte(data, SerializerFeature.WriteClassName);
  try {
    zookeeper.create(path, bytes, CreateMode.PERSISTENT);
  } catch (ZkNoNodeException e) {
    // process节点不存在,出现了rollback/shutdown操作,直接忽略
    logger.warn("pipelineId[{}] extract ignore processId[{}] single by data:{}",
          new Object[] { data.getPipelineId(), data.getProcessId(), data });
  } catch (ZkNodeExistsException e) {
    // process节点已存在,出现了ConnectionLoss retry操作
    logger.warn("pipelineId[{}] extract ignore processId[{}] single by data:{}",
          new Object[] { data.getPipelineId(), data.getProcessId(), data });
  } catch (ZkInterruptedException e) {
    // ignore
  } catch (ZkException e) {
    throw new ArbitrateException("Extract_single", e.getMessage(), e);
  }
}

代码示例来源:origin: com.alibaba.otter/shared.arbitrate

/**
 * <pre>
 * 算法:
 * 1. 创建对应的selected节点,标志selected已完成
 * </pre>
 * 
 * @param pipelineId 同步流id
 */
public void single(EtlEventData data) {
  Assert.notNull(data);
  String path = StagePathUtils.getSelectStage(data.getPipelineId(), data.getProcessId());
  data.setCurrNid(ArbitrateConfigUtils.getCurrentNid());
  // 序列化
  byte[] bytes = JsonUtils.marshalToByte(data, SerializerFeature.WriteClassName);
  try {
    zookeeper.create(path, bytes, CreateMode.PERSISTENT);
  } catch (ZkNoNodeException e) {
    // process节点不存在,出现了rollback/shutdown操作,直接忽略
    logger.warn("pipelineId[{}] select ignore processId[{}] single by data:{}",
          new Object[] { data.getPipelineId(), data.getProcessId(), data });
  } catch (ZkNodeExistsException e) {
    // process节点已存在,出现了ConnectionLoss retry操作
    logger.warn("pipelineId[{}] select ignore processId[{}] single by data:{}",
          new Object[] { data.getPipelineId(), data.getProcessId(), data });
  } catch (ZkException e) {
    throw new ArbitrateException("Select_single", e.getMessage(), e);
  }
}

代码示例来源:origin: com.weibo/motan-registry-zookeeper

@Override
protected Registry createRegistry(URL registryUrl) {
  try {
    int timeout = registryUrl.getIntParameter(URLParamType.connectTimeout.getName(), URLParamType.connectTimeout.getIntValue());
    int sessionTimeout = registryUrl.getIntParameter(URLParamType.registrySessionTimeout.getName(), URLParamType.registrySessionTimeout.getIntValue());
    ZkClient zkClient = createInnerZkClient(registryUrl.getParameter("address"), sessionTimeout, timeout);
    return new ZookeeperRegistry(registryUrl, zkClient);
  } catch (ZkException e) {
    LoggerUtil.error("[ZookeeperRegistry] fail to connect zookeeper, cause: " + e.getMessage());
    throw e;
  }
}

代码示例来源:origin: com.alibaba.otter/shared.arbitrate

return await(pipelineId);// /出现节点不存在,说明出现了error情况,递归调用重新获取一次
} catch (ZkException e) {
  throw new ArbitrateException("Select_await", e.getMessage(), e);

代码示例来源:origin: com.alibaba.otter/shared.arbitrate

return await(pipelineId);// /出现节点不存在,说明出现了error情况,递归调用重新获取一次
} catch (ZkException e) {
  throw new ArbitrateException("Select_await", e.getMessage(), e);

代码示例来源:origin: com.alibaba.otter/shared.arbitrate

return await(pipelineId);// /出现节点不存在,说明出现了error情况,递归调用重新获取一次
} catch (ZkException e) {
  throw new ArbitrateException("transform_await", e.getMessage(), e);

代码示例来源:origin: com.alibaba.otter/shared.arbitrate

return await(pipelineId);// /出现节点不存在,说明出现了error情况,递归调用重新获取一次
} catch (ZkException e) {
  throw new ArbitrateException("Extract_await", e.getMessage(), e);

相关文章