8002048: Protocol to discovery of manageable Java processes on a network
authordsamersoff
Sun, 03 Feb 2013 22:28:08 +0400
changeset 15460 ac08a4bdd0f6
parent 15459 b0c59cfcaa15
child 15462 0b1f234cea2a
8002048: Protocol to discovery of manageable Java processes on a network Summary: Introduce a protocol to discover manageble Java instances across a network subnet, JDP Reviewed-by: sla, dfuchs
hotspot/src/share/vm/services/diagnosticCommand.cpp
hotspot/src/share/vm/services/diagnosticCommand.hpp
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Sat Feb 02 20:13:27 2013 +0100
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Sun Feb 03 22:28:08 2013 +0400
@@ -464,7 +464,32 @@
 
   _jmxremote_ssl_config_file
   ("jmxremote.ssl.config.file",
-   "set com.sun.management.jmxremote.ssl_config_file", "STRING", false)
+   "set com.sun.management.jmxremote.ssl_config_file", "STRING", false),
+
+// JDP Protocol support
+  _jmxremote_autodiscovery
+  ("jmxremote.autodiscovery",
+   "set com.sun.management.jmxremote.autodiscovery", "STRING", false),
+
+   _jdp_port
+  ("jdp.port",
+   "set com.sun.management.jdp.port", "INT", false),
+
+   _jdp_address
+  ("jdp.address",
+   "set com.sun.management.jdp.address", "STRING", false),
+
+   _jdp_source_addr
+  ("jdp.source_addr",
+   "set com.sun.management.jdp.source_addr", "STRING", false),
+
+   _jdp_ttl
+  ("jdp.ttl",
+   "set com.sun.management.jdp.ttl", "INT", false),
+
+   _jdp_pause
+  ("jdp.pause",
+   "set com.sun.management.jdp.pause", "INT", false)
 
   {
     _dcmdparser.add_dcmd_option(&_config_file);
@@ -480,6 +505,12 @@
     _dcmdparser.add_dcmd_option(&_jmxremote_ssl_enabled_protocols);
     _dcmdparser.add_dcmd_option(&_jmxremote_ssl_need_client_auth);
     _dcmdparser.add_dcmd_option(&_jmxremote_ssl_config_file);
+    _dcmdparser.add_dcmd_option(&_jmxremote_autodiscovery);
+    _dcmdparser.add_dcmd_option(&_jdp_port);
+    _dcmdparser.add_dcmd_option(&_jdp_address);
+    _dcmdparser.add_dcmd_option(&_jdp_source_addr);
+    _dcmdparser.add_dcmd_option(&_jdp_ttl);
+    _dcmdparser.add_dcmd_option(&_jdp_pause);
 }
 
 
@@ -494,7 +525,6 @@
   }
 }
 
-
 void JMXStartRemoteDCmd::execute(TRAPS) {
     ResourceMark rm(THREAD);
     HandleMark hm(THREAD);
@@ -524,7 +554,9 @@
     // file.
 #define PUT_OPTION(a) \
     if ( (a).is_set() ){ \
-        options.print("%scom.sun.management.%s=%s", comma, (a).name(), (a).value()); \
+        options.print(\
+               ( *((a).type()) == 'I' ) ? "%scom.sun.management.%s=%d" : "%scom.sun.management.%s=%s",\
+                comma, (a).name(), (a).value()); \
         comma[0] = ','; \
     }
 
@@ -541,6 +573,12 @@
     PUT_OPTION(_jmxremote_ssl_enabled_protocols);
     PUT_OPTION(_jmxremote_ssl_need_client_auth);
     PUT_OPTION(_jmxremote_ssl_config_file);
+    PUT_OPTION(_jmxremote_autodiscovery);
+    PUT_OPTION(_jdp_port);
+    PUT_OPTION(_jdp_address);
+    PUT_OPTION(_jdp_source_addr);
+    PUT_OPTION(_jdp_ttl);
+    PUT_OPTION(_jdp_pause);
 
 #undef PUT_OPTION
 
--- a/hotspot/src/share/vm/services/diagnosticCommand.hpp	Sat Feb 02 20:13:27 2013 +0100
+++ b/hotspot/src/share/vm/services/diagnosticCommand.hpp	Sun Feb 03 22:28:08 2013 +0400
@@ -257,6 +257,16 @@
   DCmdArgument<char *> _jmxremote_ssl_need_client_auth;
   DCmdArgument<char *> _jmxremote_ssl_config_file;
 
+  // JDP support
+  // Keep autodiscovery char* not bool to pass true/false
+  // as property value to java level.
+  DCmdArgument<char *> _jmxremote_autodiscovery;
+  DCmdArgument<jlong>  _jdp_port;
+  DCmdArgument<char *> _jdp_address;
+  DCmdArgument<char *> _jdp_source_addr;
+  DCmdArgument<jlong>  _jdp_ttl;
+  DCmdArgument<jlong>  _jdp_pause;
+
 public:
   JMXStartRemoteDCmd(outputStream *output, bool heap_allocated);