diff -r 80e1201f6c9a -r a0f39cc47387 src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java Fri Nov 22 09:06:35 2019 -0500 +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java Fri Nov 22 17:20:43 2019 +0100 @@ -43,7 +43,6 @@ static final long RESERVED_CLASS_ID_LIMIT = 400; - private volatile boolean recording; private volatile boolean nativeOK; private static native void registerNatives(); @@ -69,6 +68,15 @@ } /** + * Marks current chunk as final + *

+ * This allows streaming clients to read the chunk header and + * close the stream when no more data will be written into + * the current repository. + */ + public native void markChunkFinal(); + + /** * Begin recording events * * Requires that JFR has been started with {@link #createNativeJFR()} @@ -76,6 +84,19 @@ public native void beginRecording(); /** + * Return true if the JVM is recording + */ + public native boolean isRecording(); + + /** + * End recording events, which includes flushing data in thread buffers + * + * Requires that JFR has been started with {@link #createNativeJFR()} + * + */ + public native void endRecording(); + + /** * Return ticks * * @return the time, in ticks @@ -97,13 +118,7 @@ */ public native boolean emitEvent(long eventTypeId, long timestamp, long when); - /** - * End recording events, which includes flushing data in thread buffers - * - * Requires that JFR has been started with {@link #createNativeJFR()} - * - */ - public native void endRecording(); + /** * Return a list of all classes deriving from {@link jdk.internal.event.Event} @@ -354,20 +369,6 @@ */ public native void storeMetadataDescriptor(byte[] bytes); - public void endRecording_() { - endRecording(); - recording = false; - } - - public void beginRecording_() { - beginRecording(); - recording = true; - } - - public boolean isRecording() { - return recording; - } - /** * If the JVM supports JVM TI and retransformation has not been disabled this * method will return true. This flag can not change during the lifetime of @@ -558,4 +559,5 @@ *@return start time of the recording in nanos, -1 in case of in-memory */ public native long getChunkStartNanos(); + }