diff src/share/vm/services/diagnosticCommand.cpp @ 17827:f42c10a3d4b1

7090324: gclog rotation via external tool Summary: GC log rotation can be set via java command line, but customer sometime need to sync with OS level rotation setting. Reviewed-by: sla, minqi, ehelin Contributed-by: suenaga.yasumasa@lab.ntt.co.jp
author minqi
date Mon, 31 Mar 2014 13:09:35 -0700
parents 82a9cdbf683e
children 78bbf4d43a14
line wrap: on
line diff
--- a/src/share/vm/services/diagnosticCommand.cpp	Fri Mar 28 15:29:23 2014 -0700
+++ b/src/share/vm/services/diagnosticCommand.cpp	Mon Mar 31 13:09:35 2014 -0700
@@ -53,6 +53,7 @@
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
 #endif // INCLUDE_SERVICES
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
+  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RotateGCLogDCmd>(full_export, true, false));
 
   // Enhanced JMX Agent Support
   // These commands won't be exported via the DiagnosticCommandMBean until an
@@ -650,3 +651,11 @@
     JavaCalls::call_static(&result, ik, vmSymbols::stopRemoteAgent_name(), vmSymbols::void_method_signature(), CHECK);
 }
 
+void RotateGCLogDCmd::execute(DCmdSource source, TRAPS) {
+  if (UseGCLogFileRotation) {
+    VM_RotateGCLog rotateop(output());
+    VMThread::execute(&rotateop);
+  } else {
+    output()->print_cr("Target VM does not support GC log file rotation.");
+  }
+}