/** * Check, whether multicast is supported at all by at least one interface * * @return true if at least one network interface supports multicast */ public static boolean isMulticastSupported() throws SocketException { return getMulticastAddresses().size() != 0; }
private static List<InetAddress> getMulticastAddresses() throws SocketException, UnknownHostException { List<InetAddress> addresses = NetworkUtil.getMulticastAddresses(); if (addresses.size() == 0) { throw new UnknownHostException("Cannot find address of local host which can be used for sending discovery request"); } return addresses; }
/** * Start the responder (if not already started) */ public synchronized void start() throws IOException { if (listenerThreads.size() == 0) { List<InetAddress> addresses = hostAddress == null ? NetworkUtil.getMulticastAddresses() : Arrays.asList(hostAddress); if (addresses.size() == 0) { logHandler.info("No suitable address found for listening on multicast discovery requests"); return; } // We start a thread for every address found for (InetAddress addr : addresses) { try { MulticastSocketListenerThread thread = new MulticastSocketListenerThread("JolokiaDiscoveryListenerThread-" + addr.getHostAddress(), addr, detailsHolder, restrictor, logHandler); thread.start(); listenerThreads.add(thread); } catch (IOException exp) { logHandler.info("Couldn't start discovery thread for " + addr + ": " + exp); } } } }
/** * Check, whether multicast is supported at all by at least one interface * * @return true if at least one network interface supports multicast */ public static boolean isMulticastSupported() throws SocketException { return getMulticastAddresses().size() != 0; }
/** * Check, whether multicast is supported at all by at least one interface * * @return true if at least one network interface supports multicast */ public static boolean isMulticastSupported() throws SocketException { return getMulticastAddresses().size() != 0; }
private static List<InetAddress> getMulticastAddresses() throws SocketException, UnknownHostException { List<InetAddress> addresses = NetworkUtil.getMulticastAddresses(); if (addresses.size() == 0) { throw new UnknownHostException("Cannot find address of local host which can be used for sending discovery request"); } return addresses; }
private static List<InetAddress> getMulticastAddresses() throws SocketException, UnknownHostException { List<InetAddress> addresses = NetworkUtil.getMulticastAddresses(); if (addresses.size() == 0) { throw new UnknownHostException("Cannot find address of local host which can be used for sending discovery request"); } return addresses; }
/** * Start the responder (if not already started) */ public synchronized void start() throws IOException { if (listenerThreads.size() == 0) { List<InetAddress> addresses = hostAddress == null ? NetworkUtil.getMulticastAddresses() : Arrays.asList(hostAddress); if (addresses.size() == 0) { logHandler.info("No suitable address found for listening on multicast discovery requests"); return; } // We start a thread for every address found for (InetAddress addr : addresses) { try { MulticastSocketListenerThread thread = new MulticastSocketListenerThread("JolokiaDiscoveryListenerThread-" + addr.getHostAddress(), addr, detailsHolder, restrictor, logHandler); thread.start(); listenerThreads.add(thread); } catch (IOException exp) { logHandler.info("Couldn't start discovery thread for " + addr + ": " + exp); } } } }
/** * Start the responder (if not already started) */ public synchronized void start() throws IOException { if (listenerThreads.size() == 0) { List<InetAddress> addresses = hostAddress == null ? NetworkUtil.getMulticastAddresses() : Arrays.asList(hostAddress); if (addresses.size() == 0) { logHandler.info("No suitable address found for listening on multicast discovery requests"); return; } // We start a thread for every address found for (InetAddress addr : addresses) { try { MulticastSocketListenerThread thread = new MulticastSocketListenerThread("JolokiaDiscoveryListenerThread-" + addr.getHostAddress(), addr, detailsHolder, restrictor, logHandler); thread.start(); listenerThreads.add(thread); } catch (IOException exp) { logHandler.info("Couldn't start discovery thread for " + addr + ": " + exp); } } } }