org.apache.zookeeper.server.ZooKeeperServerConf.toMap()方法的使用及代码示例

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

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

ZooKeeperServerConf.toMap介绍

[英]Converts this configuration to a map. The returned map is mutable, and changes to it do not reflect back into this configuration.
[中]将此配置转换为映射。返回的映射是可变的,对它的更改不会反映到该配置中。

代码示例

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

@Override
  public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
    CommandResponse response = initializeResponse();
    response.putAll(zkServer.getConf().toMap());
    return response;
  }
}

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

@Test public void testToMap() {
    Map<String, Object> m = c.toMap();
    assertEquals(8, m.size());
    assertEquals(Integer.valueOf(1), m.get(ZooKeeperServerConf.KEY_CLIENT_PORT));
    assertEquals("a", m.get(ZooKeeperServerConf.KEY_DATA_DIR));
    assertEquals("b", m.get(ZooKeeperServerConf.KEY_DATA_LOG_DIR));
    assertEquals(Integer.valueOf(2), m.get(ZooKeeperServerConf.KEY_TICK_TIME));
    assertEquals(Integer.valueOf(3), m.get(ZooKeeperServerConf.KEY_MAX_CLIENT_CNXNS));
    assertEquals(Integer.valueOf(4), m.get(ZooKeeperServerConf.KEY_MIN_SESSION_TIMEOUT));
    assertEquals(Integer.valueOf(5), m.get(ZooKeeperServerConf.KEY_MAX_SESSION_TIMEOUT));
    assertEquals(Long.valueOf(6L), m.get(ZooKeeperServerConf.KEY_SERVER_ID));
  }
}

相关文章

ZooKeeperServerConf类方法