src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdConfigure.java
branchJEP-349-branch
changeset 57752 7072cf06887a
parent 53013 c8b2a408628b
child 57858 9254b05c141c
equal deleted inserted replaced
57747:c942aab1fbec 57752:7072cf06887a
    25 
    25 
    26 package jdk.jfr.internal.dcmd;
    26 package jdk.jfr.internal.dcmd;
    27 
    27 
    28 
    28 
    29 
    29 
       
    30 import jdk.jfr.FlightRecorder;
    30 import jdk.jfr.internal.LogLevel;
    31 import jdk.jfr.internal.LogLevel;
    31 import jdk.jfr.internal.LogTag;
    32 import jdk.jfr.internal.LogTag;
    32 import jdk.jfr.internal.Logger;
    33 import jdk.jfr.internal.Logger;
    33 import jdk.jfr.internal.Options;
    34 import jdk.jfr.internal.Options;
       
    35 import jdk.jfr.internal.PlatformRecorder;
       
    36 import jdk.jfr.internal.PrivateAccess;
    34 import jdk.jfr.internal.Repository;
    37 import jdk.jfr.internal.Repository;
    35 import jdk.jfr.internal.SecuritySupport.SafePath;
    38 import jdk.jfr.internal.SecuritySupport.SafePath;
    36 
    39 
    37 /**
    40 /**
    38  * JFR.configure - invoked from native
    41  * JFR.configure - invoked from native
    87         if (repositoryPath != null) {
    90         if (repositoryPath != null) {
    88             try {
    91             try {
    89                 SafePath s = new SafePath(repositoryPath);
    92                 SafePath s = new SafePath(repositoryPath);
    90                 Repository.getRepository().setBasePath(s);
    93                 Repository.getRepository().setBasePath(s);
    91                 Logger.log(LogTag.JFR, LogLevel.INFO, "Base repository path set to " + repositoryPath);
    94                 Logger.log(LogTag.JFR, LogLevel.INFO, "Base repository path set to " + repositoryPath);
       
    95                 if (FlightRecorder.isInitialized()) {
       
    96                     PrivateAccess.getInstance().getPlatformRecorder().rotateIfRecordingToDisk();;
       
    97                 }
    92             } catch (Exception e) {
    98             } catch (Exception e) {
    93                 throw new DCmdException("Could not use " + repositoryPath + " as repository. " + e.getMessage(), e);
    99                 throw new DCmdException("Could not use " + repositoryPath + " as repository. " + e.getMessage(), e);
    94             }
   100             }
    95             printRepositoryPath();
   101             printRepositoryPath();
    96             updated = true;
   102             updated = true;