src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdConfigure.java
changeset 59226 a0f39cc47387
parent 58863 c16ac7a2eba4
equal deleted inserted replaced
59225:80e1201f6c9a 59226:a0f39cc47387
    30 import jdk.jfr.FlightRecorder;
    30 import jdk.jfr.FlightRecorder;
    31 import jdk.jfr.internal.LogLevel;
    31 import jdk.jfr.internal.LogLevel;
    32 import jdk.jfr.internal.LogTag;
    32 import jdk.jfr.internal.LogTag;
    33 import jdk.jfr.internal.Logger;
    33 import jdk.jfr.internal.Logger;
    34 import jdk.jfr.internal.Options;
    34 import jdk.jfr.internal.Options;
       
    35 import jdk.jfr.internal.PlatformRecorder;
    35 import jdk.jfr.internal.PrivateAccess;
    36 import jdk.jfr.internal.PrivateAccess;
    36 import jdk.jfr.internal.Repository;
    37 import jdk.jfr.internal.Repository;
    37 import jdk.jfr.internal.SecuritySupport.SafePath;
    38 import jdk.jfr.internal.SecuritySupport.SafePath;
    38 
    39 
    39 /**
    40 /**
    87 
    88 
    88         boolean updated = false;
    89         boolean updated = false;
    89         if (repositoryPath != null) {
    90         if (repositoryPath != null) {
    90             try {
    91             try {
    91                 SafePath s = new SafePath(repositoryPath);
    92                 SafePath s = new SafePath(repositoryPath);
    92                 Repository.getRepository().setBasePath(s);
    93                 if (FlightRecorder.isInitialized()) {
       
    94                     PrivateAccess.getInstance().getPlatformRecorder().migrate(s);
       
    95                 } else {
       
    96                     Repository.getRepository().setBasePath(s);
       
    97                 }
    93                 Logger.log(LogTag.JFR, LogLevel.INFO, "Base repository path set to " + repositoryPath);
    98                 Logger.log(LogTag.JFR, LogLevel.INFO, "Base repository path set to " + repositoryPath);
    94                 if (FlightRecorder.isInitialized()) {
       
    95                     PrivateAccess.getInstance().getPlatformRecorder().rotateIfRecordingToDisk();;
       
    96                 }
       
    97             } catch (Exception e) {
    99             } catch (Exception e) {
    98                 throw new DCmdException("Could not use " + repositoryPath + " as repository. " + e.getMessage(), e);
   100                 throw new DCmdException("Could not use " + repositoryPath + " as repository. " + e.getMessage(), e);
    99             }
   101             }
   100             printRepositoryPath();
   102             printRepositoryPath();
   101             updated = true;
   103             updated = true;