gpt4 book ai didi

com.baidu.disconf.core.common.zookeeper.ZookeeperMgr.getInstance()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:47:28 28 4
gpt4 key购买 nike

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

ZookeeperMgr.getInstance介绍

暂无

代码示例

代码示例来源:origin: knightliao/disconf

/**
 * 创建路径
 */
private void makePath(String path, String data) {
  ZookeeperMgr.getInstance().makeDir(path, data);
}

代码示例来源:origin: knightliao/disconf

/**
 * @Description: 获取自己的主备类型
 */
public void init(String hosts, String zooUrlPrefix, boolean debug) throws Exception {
  this.zooUrlPrefix = zooUrlPrefix;
  this.debug = debug;
  // init zookeeper
  ZookeeperMgr.getInstance().init(hosts, zooUrlPrefix, debug);
}

代码示例来源:origin: knightliao/disconf

@Override
public void release() {
  try {
    ZookeeperMgr.getInstance().release();
  } catch (InterruptedException e) {
    LOGGER.error(e.toString());
  }
}

代码示例来源:origin: knightliao/disconf

/**
 */
public void monitorMaster() {
  //
  // 监控
  //
  Stat stat = new Stat();
  try {
    ZookeeperMgr.getInstance().read(monitorPath, this, stat);
  } catch (InterruptedException e) {
    LOGGER.info(e.toString());
  } catch (KeeperException e) {
    LOGGER.error("cannot monitor " + monitorPath, e);
  }
  LOGGER.debug("monitor path: (" + monitorPath + "," + keyName + "," + disConfigTypeEnum.getModelName() +
      ") has been added!");
}

代码示例来源:origin: knightliao/disconf

/**
 * 在指定路径下创建一个临时结点
 */
private void makeTempChildPath(String path, String data) {
  String finerPrint = DisClientComConfig.getInstance().getInstanceFingerprint();
  String mainTypeFullStr = path + "/" + finerPrint;
  try {
    ZookeeperMgr.getInstance().createEphemeralNode(mainTypeFullStr, data, CreateMode.EPHEMERAL);
  } catch (Exception e) {
    LOGGER.error("cannot create: " + mainTypeFullStr + "\t" + e.toString());
  }
}

代码示例来源:origin: knightliao/disconf

/**
   * 写结点
   */
  @Test
  public final void testWritePersistentUrl() {

    try {

      Random random = new Random();
      int randomInt = random.nextInt();

      // 写
      String url = "/disconfserver/dan_dnwebbilling_1_0_online";
      ZookeeperMgr.getInstance().writePersistentUrl(url, String.valueOf(randomInt));

      // 读
      String readData = ZookeeperMgr.getInstance().readUrl(url, null);
      Assert.assertEquals(String.valueOf(randomInt), readData);

    } catch (Exception e) {
      Assert.assertTrue(false);
    }
  }
}

代码示例来源:origin: knightliao/disconf

ZookeeperMgr.getInstance().reconnect();

代码示例来源:origin: knightliao/disconf

/**
 * 测试获取Root子节点
 */
@Test
public final void testGetRootChildren() {
  final ZookeeperMgr obj = ZookeeperMgr.getInstance();
  //
  // 注入
  //
  new NonStrictExpectations(obj) {
    {
      ResilientActiveKeyValueStore store = new ResilientActiveKeyValueStoreMock();
      this.setField(obj, "store", store);
    }
  };
  List<String> list = ZookeeperMgr.getInstance().getRootChildren();
  for (String item : list) {
    System.out.println(item);
  }
  Assert.assertTrue(list.size() > 0);
}

代码示例来源:origin: knightliao/disconf

disConfCommonModel.getEnv(),
    disConfCommonModel.getVersion());
ZookeeperMgr.getInstance().makeDir(clientRootZooPath, ZooUtils.getIp());

代码示例来源:origin: com.baidu.disconf/disconf-client

/**
 * 创建路径
 */
private void makePath(String path, String data) {
  ZookeeperMgr.getInstance().makeDir(path, data);
}

代码示例来源:origin: com.baidu.disconf/disconf-client

/**
 * @Description: 获取自己的主备类型
 */
public void init(String hosts, String zooUrlPrefix, boolean debug) throws Exception {
  this.zooUrlPrefix = zooUrlPrefix;
  this.debug = debug;
  // init zookeeper
  ZookeeperMgr.getInstance().init(hosts, zooUrlPrefix, debug);
}

代码示例来源:origin: com.baidu.disconf/disconf-client

@Override
public void release() {
  try {
    ZookeeperMgr.getInstance().release();
  } catch (InterruptedException e) {
    LOGGER.error(e.toString());
  }
}

代码示例来源:origin: com.baidu.disconf/disconf-client

/**
 */
public void monitorMaster() {
  //
  // 监控
  //
  Stat stat = new Stat();
  try {
    ZookeeperMgr.getInstance().read(monitorPath, this, stat);
  } catch (InterruptedException e) {
    LOGGER.info(e.toString());
  } catch (KeeperException e) {
    LOGGER.error("cannot monitor " + monitorPath, e);
  }
  LOGGER.debug("monitor path: (" + monitorPath + "," + keyName + "," + disConfigTypeEnum.getModelName() +
      ") has been added!");
}

代码示例来源:origin: com.baidu.disconf/disconf-client

/**
 * 在指定路径下创建一个临时结点
 */
private void makeTempChildPath(String path, String data) {
  String finerPrint = DisClientComConfig.getInstance().getInstanceFingerprint();
  String mainTypeFullStr = path + "/" + finerPrint;
  try {
    ZookeeperMgr.getInstance().createEphemeralNode(mainTypeFullStr, data, CreateMode.EPHEMERAL);
  } catch (Exception e) {
    LOGGER.error("cannot create: " + mainTypeFullStr + "\t" + e.toString());
  }
}

代码示例来源:origin: com.baidu.disconf/disconf-client

ZookeeperMgr.getInstance().reconnect();

代码示例来源:origin: com.baidu.disconf/disconf-client

disConfCommonModel.getEnv(),
    disConfCommonModel.getVersion());
ZookeeperMgr.getInstance().makeDir(clientRootZooPath, ZooUtils.getIp());

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com