src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdConfigure.java
changeset 58863 c16ac7a2eba4
parent 53013 c8b2a408628b
child 59226 a0f39cc47387
equal deleted inserted replaced
58861:2c3cc4b01880 58863:c16ac7a2eba4
     1 /*
     1 /*
     2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    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.PrivateAccess;
    34 import jdk.jfr.internal.Repository;
    36 import jdk.jfr.internal.Repository;
    35 import jdk.jfr.internal.SecuritySupport.SafePath;
    37 import jdk.jfr.internal.SecuritySupport.SafePath;
    36 
    38 
    37 /**
    39 /**
    38  * JFR.configure - invoked from native
    40  * JFR.configure - invoked from native
    87         if (repositoryPath != null) {
    89         if (repositoryPath != null) {
    88             try {
    90             try {
    89                 SafePath s = new SafePath(repositoryPath);
    91                 SafePath s = new SafePath(repositoryPath);
    90                 Repository.getRepository().setBasePath(s);
    92                 Repository.getRepository().setBasePath(s);
    91                 Logger.log(LogTag.JFR, LogLevel.INFO, "Base repository path set to " + repositoryPath);
    93                 Logger.log(LogTag.JFR, LogLevel.INFO, "Base repository path set to " + repositoryPath);
       
    94                 if (FlightRecorder.isInitialized()) {
       
    95                     PrivateAccess.getInstance().getPlatformRecorder().rotateIfRecordingToDisk();;
       
    96                 }
    92             } catch (Exception e) {
    97             } catch (Exception e) {
    93                 throw new DCmdException("Could not use " + repositoryPath + " as repository. " + e.getMessage(), e);
    98                 throw new DCmdException("Could not use " + repositoryPath + " as repository. " + e.getMessage(), e);
    94             }
    99             }
    95             printRepositoryPath();
   100             printRepositoryPath();
    96             updated = true;
   101             updated = true;