public static ClientMetadata getClientMetadata(HankClientIface client) { String hostName; try { hostName = LocalHostUtils.getHostName(); } catch (UnknownHostException e) { hostName = "unknown"; } return new ClientMetadata( hostName, System.currentTimeMillis(), client.getClass().getName(), Hank.getGitCommit()); } }
@Override public void run() { try { notifyGlobalNotifiers(new StringNotification("Hank monitor stopping on " + LocalHostUtils.getHostName() + ".")); } catch (UnknownHostException e) { notifyGlobalNotifiers(new StringNotification("Hank monitor stopping on 'unknown host'.")); } stop(); } });
public static void main(String[] args) throws IOException, InvalidConfigurationException, InterruptedException { CommandLineChecker.check(args, new String[]{"configuration_file_path", "log4j_properties_file_path"}, PartitionServer.class); String configPath = args[0]; String log4jprops = args[1]; PartitionServerConfigurator configurator = new YamlPartitionServerConfigurator(configPath); PropertyConfigurator.configure(log4jprops); new PartitionServer(configurator, getHostName()).run(); }
public Monitor(Coordinator coordinator, MonitorConfigurator configurator) throws IOException, InvalidConfigurationException { globalNotifiers = configurator.getGlobalNotifiers(); try { notifyGlobalNotifiers(new StringNotification("Hank monitor starting on " + LocalHostUtils.getHostName() + ".")); } catch (UnknownHostException e) { notifyGlobalNotifiers(new StringNotification("Hank monitor starting on 'unknown host'.")); } addShutdownHook(); for (RingGroup ringGroup : coordinator.getRingGroups()) { List<Notifier> notifiers; try { notifiers = configurator.getRingGroupNotifiers(ringGroup); ringGroupNotifiers.addAll(notifiers); ringGroupMonitors.add(new RingGroupMonitor(ringGroup, notifiers)); } catch (InvalidConfigurationException e) { LOG.error("Invalid configuration for Ring Group " + ringGroup.getName(), e); notifyGlobalNotifiers(new StringNotification("Ignoring Ring Group " + ringGroup.getName() + " since the corresponding configuration was invalid. It will not be monitored.")); } } }
for (int i = 0; i < 16; ++i) { rg0.registerClient(new ClientMetadata( LocalHostUtils.getHostName(), System.currentTimeMillis(), "HankSmartClient",