diff src/share/vm/utilities/ostream.hpp @ 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 55fb97c4c58d
children 78bbf4d43a14
line wrap: on
line diff
--- a/src/share/vm/utilities/ostream.hpp	Fri Mar 28 15:29:23 2014 -0700
+++ b/src/share/vm/utilities/ostream.hpp	Mon Mar 31 13:09:35 2014 -0700
@@ -115,7 +115,7 @@
    // flushing
    virtual void flush() {}
    virtual void write(const char* str, size_t len) = 0;
-   virtual void rotate_log() {} // GC log rotation
+   virtual void rotate_log(bool force, outputStream* out = NULL) {} // GC log rotation
    virtual ~outputStream() {}   // close properly on deletion
 
    void dec_cr() { dec(); cr(); }
@@ -240,8 +240,15 @@
   gcLogFileStream(const char* file_name);
   ~gcLogFileStream();
   virtual void write(const char* c, size_t len);
-  virtual void rotate_log();
+  virtual void rotate_log(bool force, outputStream* out = NULL);
   void dump_loggc_header();
+
+  /* If "force" sets true, force log file rotation from outside JVM */
+  bool should_rotate(bool force) {
+    return force ||
+             ((GCLogFileSize != 0) && ((uintx)_bytes_written >= GCLogFileSize));
+  }
+
 };
 
 #ifndef PRODUCT