// to be removed private static void server(String nodeId, Map<String, String> clusterConfig) { final String serviceName = "vipr-2.2.0.0.1"; try { MulticastUtil.create().publish(serviceName, nodeId, clusterConfig, 10000); } catch (Exception e) { e.printStackTrace(); System.exit(1); } }
// to be removed private static void client() { final String serviceName = "vipr-2.2.0.0.1"; try { MulticastUtil.create().list(serviceName); } catch (Exception e) { e.printStackTrace(); System.exit(1); } }
/* * Broadcast local configuration to others over the network. * @return true if broadcast successful, false if failed. */ public static boolean doBroadcast(String releaseVersion, Configuration config, long publishTime) { boolean taskSuccess = true; _log.debug("{} - broadcasting cluster configuration {}", config.getNodeId(), config.toString()); try { MulticastUtil.create(config.getHwConfig().get(PropertyConstants.PROPERTY_KEY_NETIF)) .publish(releaseVersion, config.getNodeId(), config.getConfigMap(), publishTime); } catch (IOException e) { taskSuccess = false; _log.error("broadcast configuration caught exception with: " + e.getMessage()); } finally { _log.info( "broadcast configuration via {} for {} is done", config.getHwConfig().get(PropertyConstants.PROPERTY_KEY_NETIF), config.getScenario()); } return taskSuccess; }
public static MulticastUtil create() throws IOException { return MulticastUtil.create(null); }
public static MulticastUtil create(String networkInterfaceName) throws IOException { JmDNS jmdns = JmDNS.create(MulticastUtil.getLinkLocalAddress(networkInterfaceName)); return new MulticastUtil(jmdns); }