Search in sources :

Example 1 with ClusterConfig

use of com.alibaba.jstorm.ui.model.ClusterConfig in project jstorm by alibaba.

the class ZookeeperController method show.

@RequestMapping(value = "/zookeeper", method = RequestMethod.GET)
public String show(@RequestParam(value = "name", required = true) String name, ModelMap model) {
    name = StringEscapeUtils.escapeHtml(name);
    long start = System.currentTimeMillis();
    try {
        ClusterConfig config = UIUtils.clusterConfig.get(name);
        StringBuilder builder = new StringBuilder("");
        for (String ip : config.getZkServers()) {
            builder.append(ip).append(",");
        }
        builder.deleteCharAt(builder.length() - 1);
        builder.append(":");
        builder.append(config.getZkPort());
        model.addAttribute("zkRoot", config.getZkRoot());
        model.addAttribute("zkServers", builder.toString());
        model.addAttribute("clusterName", name);
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        UIUtils.addErrorAttribute(model, e);
    }
    LOG.info("zookeeper page show cost:{}ms", System.currentTimeMillis() - start);
    return "zookeeper";
}
Also used : ClusterConfig(com.alibaba.jstorm.ui.model.ClusterConfig) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ClusterConfig (com.alibaba.jstorm.ui.model.ClusterConfig)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1