5744N/A * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 5652N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5652N/A * This code is free software; you can redistribute it and/or modify it 5652N/A * under the terms of the GNU General Public License version 2 only, as 5744N/A * published by the Free Software Foundation. Oracle designates this 5744N/A * particular file as subject to the "Classpath" exception as provided 5744N/A * by Oracle in the LICENSE file that accompanied this code. 5652N/A * This code is distributed in the hope that it will be useful, but WITHOUT 5652N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5652N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5652N/A * version 2 for more details (a copy is included in the LICENSE file that 5652N/A * You should have received a copy of the GNU General Public License version 5652N/A * 2 along with this work; if not, write to the Free Software Foundation, 5652N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5652N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5652N/A * or visit www.oracle.com if you need additional information or have any 5652N/A * JdpController is responsible to create and manage a broadcast loop 5652N/A * <p> Other part of code has no access to broadcast loop and have to use 5652N/A * {@link #startDiscoveryService(InetAddress,int,String,String) startDiscoveryService} 5652N/A * and {@link #stopDiscoveryService() stopDiscoveryService}</p> 5652N/A * <p>{@link #startDiscoveryService(InetAddress,int,String,String) startDiscoveryService} could be called multiple 5652N/A * times as it stops the running service if it is necessary. Call to {@link #stopDiscoveryService() stopDiscoveryService} 5652N/A * ignored if service isn't run</p> 5652N/A * <p> System properties below could be used to control broadcast loop behavior. 5652N/A * Property below have to be set explicitly in command line. It's not possible to 5652N/A * lead to security or network issues. 5652N/A * <li>com.sun.management.jdp.ttl - set ttl for broadcast packet</li> 5652N/A * <li>com.sun.management.jdp.pause - set broadcast interval in seconds</li> 5652N/A * <li>com.sun.management.jdp.source_addr - an address of interface to use for broadcast</li> 5652N/A * <p>null parameters values are filtered out on {@link JdpPacketWriter} level and 5652N/A * corresponding keys are not placed to packet.</p> 5652N/A // It's not possible to re-use controller, 5652N/A // nevertheless reset shutdown variable 5652N/A // pass - ignore IOException during shutdown 5652N/A // Don't allow to instantiate this class. 5652N/A // Utility to handle optional system properties 5652N/A // Parse an integer from string or return default if provided string is null 5652N/A // Parse an inet address from string or return default if provided string is null 5652N/A * @param address - multicast group address 5652N/A * @param port - udp port to use 5652N/A * @param instanceName - name of running JVM instance 5652N/A * @param url - JMX service url 5652N/A // Limit packet to local subnet by default 5652N/A // Broadcast once a 5 seconds by default 5652N/A // Converting seconds to milliseconds 5652N/A // Allow OS to choose broadcast source 5652N/A "Invalid source address provided");
5652N/A // Don't broadcast whole command line for security reason. 5652N/A // Strip everything after first space 5652N/A // Put optional explicit java instance name to packet, if user doesn't specify 5652N/A // it the key is skipped. PacketWriter is responsible to skip keys having null value. 5652N/A // Stop discovery service if it's already running 5652N/A * Stop running discovery service, 5652N/A * it's safe to attempt to stop not started service