1 /*
2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 /**
26  *  Summary
27  *  -------
28  *
29  *  Define a lightweight network protocol for discovering running and
30  *  manageable Java processes within a network subnet.
31  *
32  *
33  * Description
34  * -----------
35  *
36  * The protocol is lightweight multicast based, and works like a beacon,
37  * broadcasting the JMXService URL needed to connect to the external JMX
38  * agent if an application is started with appropriate parameters.
39  *
40  * The payload is structured like this:
41  *
42  *  4 bytes JDP magic (0xC0FFEE42)
43  *  2 bytes JDP protocol version (1)
44  *  2 bytes size of the next entry
45  *      x bytes next entry (UTF-8 encoded)
46  *  2 bytes size of next entry
47  *    ...   Rinse and repeat...
48  *
49  * The payload will be parsed as even entries being keys, odd entries being
50  * values.
51  *
52  * The standard JDP packet contains four entries:
53  *
54  * - `DISCOVERABLE_SESSION_UUID` -- Unique id of the instance; this id changes every time
55  *    the discovery protocol starts and stops
56  *
57  * - `MAIN_CLASS` -- The value of the `sun.java.command` property
58  *
59  * - `JMX_SERVICE_URL` -- The URL to connect to the JMX agent
60  *
61  * - `INSTANCE_NAME` -- The user-provided name of the running instance
62  *
63  * The protocol sends packets to 224.0.23.178:7095 by default.
64  *
65  * The protocol uses system properties to control it's behaviour:
66  * - `com.sun.management.jdp.port` -- override default port
67  *
68  * - `com.sun.management.jdp.address` -- override default address
69  *
70  * - `com.sun.management.jmxremote.autodiscovery` -- whether we should start autodiscovery or
71  * not. Autodiscovery starts if and only if following conditions are met: (autodiscovery is
72  * true OR (autodiscovery is not set AND jdp.port is set))
73  *
74  * - `com.sun.management.jdp.ttl`         -- set ttl for broadcast packet, default is 1
75  * - `com.sun.management.jdp.pause`       -- set broadcast interval in seconds default is 5
76  * - `com.sun.management.jdp.source_addr` -- an address of interface to use for broadcast
77  */
78 
79 package sun.management.jdp;
80