当前位置: 首页>>代码示例>>Java>>正文


Java NimbusClient.getConfiguredClient方法代码示例

本文整理汇总了Java中backtype.storm.utils.NimbusClient.getConfiguredClient方法的典型用法代码示例。如果您正苦于以下问题:Java NimbusClient.getConfiguredClient方法的具体用法?Java NimbusClient.getConfiguredClient怎么用?Java NimbusClient.getConfiguredClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在backtype.storm.utils.NimbusClient的用法示例。


在下文中一共展示了NimbusClient.getConfiguredClient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerMetrics

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
private Map<String, Long> registerMetrics(Set<String> names) {
    if (test || !enableMetrics) {
        return new HashMap<>();
    }
    try {
        if (client == null) {
            client = NimbusClient.getConfiguredClient(conf);
        }

        return client.getClient().registerMetrics(topologyId, names);
    } catch (Exception e) {
        LOG.error("Failed to gen metric ids", e);
        if (client != null) {
            client.close();
            client = NimbusClient.getConfiguredClient(conf);
        }
    }

    return null;
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:21,代码来源:JStormMetricsReporter.java

示例2: setTaskHeatbeat

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
private void setTaskHeatbeat(TopologyTaskHbInfo topologyTaskHbInfo) {
    try {
        if (topologyTaskHbInfo == null) {
            return;
        }
        if (topologyTaskHbInfo.get_taskHbs() == null) {
            return;
        }

        client.getClient().updateTaskHeartbeat(topologyTaskHbInfo);

        String info = "";
        for (Entry<Integer, TaskHeartbeat> entry : topologyTaskHbInfo.get_taskHbs().entrySet()) {
            info += " " + entry.getKey() + "-" + entry.getValue().get_time(); 
        }
        LOG.info("Update task heartbeat:" + info);
    } catch (TException e) {
        LOG.error("Failed to update task heartbeat info", e);
        if (client != null) {
            client.close();
            client = NimbusClient.getConfiguredClient(conf);
        }
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:25,代码来源:TaskHeartbeatUpdater.java

示例3: getNimbusClient

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
public static NimbusClient getNimbusClient(String clusterName) throws Exception {
    Map conf = UIUtils.readUiConfig();
    NimbusClient client = clientManager.get(clusterName);
    if (client != null) {
        try {
            client.getClient().getVersion();
            LOG.info("get Nimbus Client from clientManager");
        } catch (Exception e) {
            LOG.info("Nimbus has been restarted, it begin to reconnect");
            client = null;
        }
    }

    if (client == null) {
        conf = UIUtils.resetZKConfig(conf, clusterName);
        client = NimbusClient.getConfiguredClient(conf);
        clientManager.put(clusterName, client);
    }

    return client;
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:22,代码来源:NimbusClientManager.java

示例4: getTopologyDetails

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
/**
 * Get all running topology's details.
 *
 * @param conf storm's conf, used to connect nimbus
 * @return null if nimbus is not available, otherwise all TopologyDetails
 */
public static Topologies getTopologyDetails(Map<String, Object> conf) {
    NimbusClient nimbusClient = NimbusClient.getConfiguredClient(conf);
    try {
        Nimbus.Client nimbus = nimbusClient.getClient();
        Map<String, TopologyDetails> topologies = nimbus.getClusterInfo().get_topologies().stream()
                .map(topoSummary -> getTopologyDetails(nimbus, topoSummary))
                .filter(Objects::nonNull)
                .collect(Collectors.toMap(topoDetails -> topoDetails.getId(), topoDetails -> topoDetails));
        return new Topologies(topologies);
    } catch (TException e) {
    } finally {
        nimbusClient.close();
    }
    return null;
}
 
开发者ID:ADSC-Resa,项目名称:resa,代码行数:22,代码来源:TopologyHelper.java

示例5: topologyNameExists

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
private static boolean topologyNameExists(Map conf, String name) {
    NimbusClient client = NimbusClient.getConfiguredClient(conf);
    try {
        ClusterSummary summary = client.getClient().getClusterInfo();
        for(TopologySummary s : summary.get_topologies()) {
            if(s.get_name().equals(name)) {  
                return true;
            } 
        }  
        return false;

    } catch(Exception e) {
        throw new RuntimeException(e);
    } finally {
        client.close();
    }
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:18,代码来源:StormSubmitter.java

示例6: submitJar

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
public static String submitJar(Map conf, String localJar) {
    if(localJar==null) {
        throw new RuntimeException("Must submit topologies using the 'storm' client script so that StormSubmitter knows which jar to upload.");
    }
    NimbusClient client = NimbusClient.getConfiguredClient(conf);
    try {
        String uploadLocation = client.getClient().beginFileUpload();
        LOG.info("Uploading topology jar " + localJar + " to assigned location: " + uploadLocation);
        BufferFileInputStream is = new BufferFileInputStream(localJar, THRIFT_CHUNK_SIZE_BYTES);
        while(true) {
            byte[] toSubmit = is.read();
            if(toSubmit.length==0) break;
            client.getClient().uploadChunk(uploadLocation, ByteBuffer.wrap(toSubmit));
        }
        client.getClient().finishFileUpload(uploadLocation);
        LOG.info("Successfully uploaded topology jar to assigned location: " + uploadLocation);
        return uploadLocation;
    } catch(Exception e) {
        throw new RuntimeException(e);            
    } finally {
        client.close();
    }
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:24,代码来源:StormSubmitter.java

示例7: submitJar

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
public static String submitJar(Map conf, String localJar) {
    if(localJar==null) {
        throw new RuntimeException("Must submit topologies using the 'storm' client script so that StormSubmitter knows which jar to upload.");
    }
    NimbusClient client = NimbusClient.getConfiguredClient(conf);
    try {
        String uploadLocation = client.getClient().beginFileUpload();
        LOG.info("Uploading topology jar " + localJar + " to assigned location: " + uploadLocation);
        BufferFileInputStream is = new BufferFileInputStream(localJar);
        while(true) {
            byte[] toSubmit = is.read();
            if(toSubmit.length==0) break;
            client.getClient().uploadChunk(uploadLocation, ByteBuffer.wrap(toSubmit));
        }
        client.getClient().finishFileUpload(uploadLocation);
        LOG.info("Successfully uploaded topology jar to assigned location: " + uploadLocation);
        return uploadLocation;
    } catch(Exception e) {
        throw new RuntimeException(e);            
    } finally {
        client.close();
    }
}
 
开发者ID:troyding,项目名称:storm-resa,代码行数:24,代码来源:StormSubmitter.java

示例8: main

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
public static void main(String[] args) {
    NimbusClient client = null;
    try {
        Map conf = Utils.readStormConfig();
        client = NimbusClient.getConfiguredClient(conf);

        if (args.length > 0 && !StringUtils.isBlank(args[0])) {
            String topologyName = args[0];
            TopologyInfo info = client.getClient().getTopologyInfoByName(topologyName);
            System.out.println("Successfully get topology info \n" + Utils.toPrettyJsonString(info));
        } else {
            ClusterSummary clusterSummary = client.getClient().getClusterInfo();
            System.out.println("Successfully get cluster info \n" + Utils.toPrettyJsonString(clusterSummary));
        }
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        throw new RuntimeException(e);
    } finally {
        if (client != null) {
            client.close();
        }
    }
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:25,代码来源:list.java

示例9: submitRebalance

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
public static void submitRebalance(String topologyName, RebalanceOptions options, Map conf) throws Exception {
    Map stormConf = Utils.readStormConfig();
    if (conf != null) {
        stormConf.putAll(conf);
    }

    NimbusClient client = null;
    try {
        client = NimbusClient.getConfiguredClient(stormConf);
        client.getClient().rebalance(topologyName, options);
    } catch (Exception e) {
        throw e;
    } finally {
        if (client != null) {
            client.close();
        }
    }
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:19,代码来源:rebalance.java

示例10: rollbackTopology

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
private static void rollbackTopology(String topologyName) {
    Map conf = Utils.readStormConfig();
    NimbusClient client = NimbusClient.getConfiguredClient(conf);
    try {
        // update jar
        client.getClient().rollbackTopology(topologyName);
        CommandLineUtil.success("Successfully submit command rollback_topology " + topologyName);
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    } finally {
        if (client != null) {
            client.close();
        }
    }
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:17,代码来源:rollback_topology.java

示例11: main

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
public static void main(String[] args) {
    if (args == null || args.length == 0) {
        throw new InvalidParameterException("Please input topology name");
    }

    String topologyName = args[0];
    NimbusClient client = null;
    try {
        Map conf = Utils.readStormConfig();
        client = NimbusClient.getConfiguredClient(conf);
        client.getClient().deactivate(topologyName);
        System.out.println("Successfully submit command deactivate " + topologyName);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        throw new RuntimeException(e);
    } finally {
        if (client != null) {
            client.close();
        }
    }
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:23,代码来源:deactivate.java

示例12: completeTopology

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
private static void completeTopology(String topologyName)
        throws Exception {
    Map conf = Utils.readStormConfig();
    NimbusClient client = NimbusClient.getConfiguredClient(conf);
    try {
        client.getClient().completeUpgrade(topologyName);
        CommandLineUtil.success("Successfully submit command complete_upgrade " + topologyName);
    } catch (Exception ex) {
        CommandLineUtil.error("Failed to perform complete_upgrade: " + ex.getMessage());
        ex.printStackTrace();
    } finally {
        if (client != null) {
            client.close();
        }
    }
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:17,代码来源:complete_upgrade.java

示例13: main

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
public static void main(String[] args) {
    if (args == null || args.length == 0) {
        throw new InvalidParameterException("Please input topology name");
    }

    String topologyName = args[0];

    NimbusClient client = null;
    try {

        Map conf = Utils.readStormConfig();
        client = NimbusClient.getConfiguredClient(conf);

        client.getClient().activate(topologyName);

        System.out.println("Successfully submit command activate " + topologyName);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        throw new RuntimeException(e);
    } finally {
        if (client != null) {
            client.close();
        }
    }
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:27,代码来源:activate.java

示例14: main

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
    if (args == null || args.length == 0) {
        throw new InvalidParameterException("Should input topology name");
    }

    String topologyName = args[0];

    NimbusClient client = null;
    try {

        Map conf = Utils.readStormConfig();
        client = NimbusClient.getConfiguredClient(conf);

        if (args.length == 1) {

            client.getClient().killTopology(topologyName);
        } else {
            int delaySeconds = Integer.parseInt(args[1]);

            KillOptions options = new KillOptions();
            options.set_wait_secs(delaySeconds);

            client.getClient().killTopologyWithOpts(topologyName, options);

        }

        System.out.println("Successfully submit command kill " + topologyName);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        throw new RuntimeException(e);
    } finally {
        if (client != null) {
            client.close();
        }
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:42,代码来源:kill_topology.java

示例15: main

import backtype.storm.utils.NimbusClient; //导入方法依赖的package包/类
/**
 * @param args
 */
@SuppressWarnings("rawtypes")
public static void main(String[] args) {
	if (args == null || args.length == 0) {
		throw new InvalidParameterException("Should input topology name");
	}

	String topologyName = args[0];

	NimbusClient client = null;
	try {

		Map conf = Utils.readStormConfig();
		client = NimbusClient.getConfiguredClient(conf);

		if (args.length == 1) {

			client.getClient().rebalance(topologyName, null);
		} else {
			int delaySeconds = Integer.parseInt(args[1]);

			RebalanceOptions options = new RebalanceOptions();
			options.set_wait_secs(delaySeconds);

			client.getClient().rebalance(topologyName, options);
		}

		System.out.println("Successfully submit command rebalance "
				+ topologyName);
	} catch (Exception e) {
		System.out.println(e.getMessage());
		e.printStackTrace();
		throw new RuntimeException(e);
	} finally {
		if (client != null) {
			client.close();
		}
	}
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:42,代码来源:rebalance.java


注:本文中的backtype.storm.utils.NimbusClient.getConfiguredClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。