Skip to content
Permalink
Browse files

8238375: JFR Test TestJcmdStartFlushInterval is not run

Reviewed-by: egahlin, mseledtsov
  • Loading branch information
RealCLanger committed Feb 5, 2020
1 parent c09e021 commit d6aeda7b24799d7078e900957c4f6e4ad9686ca0
Showing with 9 additions and 5 deletions.
  1. +9 −5 test/jdk/jdk/jfr/jcmd/TestJcmdStartFlushInterval.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@

package jdk.jfr.jcmd;

import java.lang.reflect.Method;
import java.time.Duration;

import jdk.jfr.FlightRecorder;
@@ -36,15 +37,18 @@
* @key jfr
* @requires vm.hasJFR
* @library /test/lib /test/jdk
* @run main/othervm jdk.jfr.jcmd.TestJcmdStartReadOnlyFile
* @modules jdk.jfr/jdk.jfr:open
* @run main/othervm jdk.jfr.jcmd.TestJcmdStartFlushInterval
*/
public class TestJcmdStartFlushInterval {

public static void main(String[] args) throws Exception {
JcmdHelper.jcmd("JFR.start","flush-interval=1s");
JcmdHelper.jcmd("JFR.start", "flush-interval=2s");
Method getFlushIntervalMethod = Recording.class.getDeclaredMethod("getFlushInterval");
getFlushIntervalMethod.setAccessible(true);
for (Recording r : FlightRecorder.getFlightRecorder().getRecordings()) {
Duration d = r.getFlushInterval();
if (d.equals(Duration.ofSeconds(1))) {
Duration d = (Duration)getFlushIntervalMethod.invoke(r);
if (d.equals(Duration.ofSeconds(2))) {
return; //OK
} else {
throw new Exception("Unexpected flush-interval=" + d);

0 comments on commit d6aeda7

Please sign in to comment.