@Override public void run() { agent.stop(); } }));
public MonitorNode() { this.setNodeType(NodeType.MONITOR); } }
public static void main(String[] args) { String cfgPath = args[0]; start(cfgPath); }
public static void start(String cfgPath) { if (!started.compareAndSet(false, true)) { return; } try { MonitorCfg cfg = MonitorCfgLoader.load(cfgPath); agent.setRegistryAddress(cfg.getRegistryAddress()); agent.setClusterName(cfg.getClusterName()); if (StringUtils.isNotEmpty(cfg.getBindIp())) { agent.setBindIp(cfg.getBindIp()); } if (StringUtils.isNotEmpty(cfg.getIdentity())) { agent.setIdentity(cfg.getIdentity()); } for (Map.Entry<String, String> config : cfg.getConfigs().entrySet()) { agent.addConfig(config.getKey(), config.getValue()); } agent.start(); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { agent.stop(); } })); } catch (CfgException e) { System.err.println("Monitor Startup Error: " + e.getMessage()); e.printStackTrace(); } }
@Override public void afterPropertiesSet() throws Exception { properties.checkProperties(); agent = new MonitorAgent(); agent.setRegistryAddress(properties.getRegistryAddress()); if (StringUtils.isNotEmpty(properties.getClusterName())) { agent.setClusterName(properties.getClusterName()); } if (StringUtils.isNotEmpty(properties.getIdentity())) { agent.setIdentity(properties.getIdentity()); } if (StringUtils.isNotEmpty(properties.getBindIp())) { agent.setBindIp(properties.getBindIp()); } if (CollectionUtils.isNotEmpty(properties.getConfigs())) { for (Map.Entry<String, String> entry : properties.getConfigs().entrySet()) { agent.addConfig(entry.getKey(), entry.getValue()); } } agent.start(); }
public MonitorAgent() { this.appContext = new MonitorAppContext(); this.node = NodeFactory.create(MonitorNode.class); this.config = JobNodeConfigFactory.getDefaultConfig(); this.config.setNodeType(node.getNodeType()); this.appContext.setConfig(config); }
private void initNode() { config.setListenPort(this.appContext.getHttpCmdPort()); NodeFactory.build(node, config); this.node.setHttpCmdPort(this.appContext.getHttpCmdPort()); }
@Override public String nodeIdentity() { return appContext.getConfig().getIdentity(); }
public static void start(String cfgPath) { if (!started.compareAndSet(false, true)) { return; } try { MonitorCfg cfg = MonitorCfgLoader.load(cfgPath); agent.setRegistryAddress(cfg.getRegistryAddress()); agent.setClusterName(cfg.getClusterName()); if (StringUtils.isNotEmpty(cfg.getBindIp())) { agent.setBindIp(cfg.getBindIp()); } if (StringUtils.isNotEmpty(cfg.getIdentity())) { agent.setIdentity(cfg.getIdentity()); } for (Map.Entry<String, String> config : cfg.getConfigs().entrySet()) { agent.addConfig(config.getKey(), config.getValue()); } agent.start(); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { agent.stop(); } })); } catch (CfgException e) { System.err.println("Monitor Startup Error: " + e.getMessage()); e.printStackTrace(); } }
@Override public void afterPropertiesSet() throws Exception { properties.checkProperties(); agent = new MonitorAgent(); agent.setRegistryAddress(properties.getRegistryAddress()); if (StringUtils.isNotEmpty(properties.getClusterName())) { agent.setClusterName(properties.getClusterName()); } if (StringUtils.isNotEmpty(properties.getIdentity())) { agent.setIdentity(properties.getIdentity()); } if (StringUtils.isNotEmpty(properties.getBindIp())) { agent.setBindIp(properties.getBindIp()); } if (CollectionUtils.isNotEmpty(properties.getConfigs())) { for (Map.Entry<String, String> entry : properties.getConfigs().entrySet()) { agent.addConfig(entry.getKey(), entry.getValue()); } } agent.start(); }
public MonitorAgent() { this.appContext = new MonitorAppContext(); this.node = NodeFactory.create(MonitorNode.class); this.config = JobNodeConfigFactory.getDefaultConfig(); this.config.setNodeType(node.getNodeType()); this.appContext.setConfig(config); }
@Override public void run() { agent.stop(); } }));
private void initNode() { config.setListenPort(this.appContext.getHttpCmdPort()); NodeFactory.build(node, config); this.node.setHttpCmdPort(this.appContext.getHttpCmdPort()); }
public MonitorNode() { this.setNodeType(NodeType.MONITOR); } }
public static void main(String[] args) { String cfgPath = args[0]; start(cfgPath); }
@Override public String nodeIdentity() { return appContext.getConfig().getIdentity(); }
@Override public void destroy() throws Exception { if (agent != null) { agent.stop(); } }
@Override public void destroy() throws Exception { if (agent != null) { agent.stop(); } }
public static void stop() { if (started.compareAndSet(true, false)) { agent.stop(); } }
public static void stop() { if (started.compareAndSet(true, false)) { agent.stop(); } }