src/jdk.jfr/share/classes/jdk/jfr/internal/Repository.java
changeset 59226 a0f39cc47387
parent 58863 c16ac7a2eba4
equal deleted inserted replaced
59225:80e1201f6c9a 59226:a0f39cc47387
    83     synchronized RepositoryChunk newChunk(Instant timestamp) {
    83     synchronized RepositoryChunk newChunk(Instant timestamp) {
    84         try {
    84         try {
    85             if (!SecuritySupport.existDirectory(repository)) {
    85             if (!SecuritySupport.existDirectory(repository)) {
    86                 this.repository = createRepository(baseLocation);
    86                 this.repository = createRepository(baseLocation);
    87                 jvm.setRepositoryLocation(repository.toString());
    87                 jvm.setRepositoryLocation(repository.toString());
       
    88                 SecuritySupport.setProperty(JFR_REPOSITORY_LOCATION_PROPERTY, repository.toString());
    88                 cleanupDirectories.add(repository);
    89                 cleanupDirectories.add(repository);
    89             }
    90             }
    90             return new RepositoryChunk(repository, timestamp);
    91             return new RepositoryChunk(repository, timestamp);
    91         } catch (Exception e) {
    92         } catch (Exception e) {
    92             String errorMsg = String.format("Could not create chunk in repository %s, %s", repository, e.getMessage());
    93             String errorMsg = String.format("Could not create chunk in repository %s, %s", repository, e.getMessage());
   113         }
   114         }
   114 
   115 
   115         if (i == MAX_REPO_CREATION_RETRIES) {
   116         if (i == MAX_REPO_CREATION_RETRIES) {
   116             throw new IOException("Unable to create JFR repository directory using base location (" + basePath + ")");
   117             throw new IOException("Unable to create JFR repository directory using base location (" + basePath + ")");
   117         }
   118         }
   118         SafePath canonicalRepositoryPath = SecuritySupport.toRealPath(f);
   119         return SecuritySupport.toRealPath(f);
   119         SecuritySupport.setProperty(JFR_REPOSITORY_LOCATION_PROPERTY, canonicalRepositoryPath.toString());
       
   120         return canonicalRepositoryPath;
       
   121     }
   120     }
   122 
   121 
   123     private static SafePath createRealBasePath(SafePath safePath) throws IOException {
   122     private static SafePath createRealBasePath(SafePath safePath) throws IOException {
   124         if (SecuritySupport.exists(safePath)) {
   123         if (SecuritySupport.exists(safePath)) {
   125             if (!SecuritySupport.isWritable(safePath)) {
   124             if (!SecuritySupport.isWritable(safePath)) {