Changeset 1905f2d


Ignore:
Timestamp:
Aug 31, 2017 3:44:26 PM (3 weeks ago)
Author:
www-data <www-data@…>
Branches:
master
Children:
b6a2369
Parents:
f49f6e2
git-author:
Bang Pham Huu <b.phamhuu@…> (08/31/17 10:53:27)
git-committer:
www-data <www-data@…> (08/31/17 15:44:26)
Message:

ticket:502 - Fix error with delete temp directory for gdal-java when starting petascope

Summary:
GDAL JNI is used in petascope and it is copied to /tmp/rasdaman/gdal_java folder everytime petascope applications (main, migration) start.
Then, it will load these files to JVM and this folder could be removed when petascope restarts. FileUtils? cannot remove this folder properly, so it needs to use the shell command to remove and it will not throw exception
as folder cannot be removed.

Test Plan: Tested by running migration application which uses root permission, then start petascope with tomcat permission.

Reviewers: dmisev

Differential Revision: http://codereview.rasdaman.org/D460

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/petascope/petascope_core/src/main/java/org/rasdaman/InitAllConfigurationsApplicationService.java

    rebe87df r1905f2d  
    2525import java.io.IOException;
    2626import java.lang.reflect.Field;
     27import java.nio.file.Files;
    2728import java.text.SimpleDateFormat;
    2829import java.util.Arrays;
     
    6364     */
    6465    public static void addLibraryPath(String libraryName, String pathToAdd) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, IOException, InterruptedException {
    65         final String tmpTargetNativeDefaultFolderPath = "/tmp/rasdaman/" + libraryName;         
    66    
    67         // Remove this temp directory for the gdal library as it already loaded in JVM
    68         FileUtils.deleteDirectory(new File(tmpTargetNativeDefaultFolderPath));
     66        final String tmpTargetNativeDefaultFolderPath = "/tmp/rasdaman/" + libraryName;
     67        Runtime rt = Runtime.getRuntime();
     68        if (new File(tmpTargetNativeDefaultFolderPath).exists()) {
     69            // Remove this temp directory for the gdal library as it already loaded in JVM
     70            rt.exec("rm -rf " + tmpTargetNativeDefaultFolderPath);
     71        }
    6972       
    7073        String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
     
    110113        // As the war file can be run from terminal which has different user name (e.g: rasdaman not tomcat)
    111114        // So must set it to 777 permission then the folder can be deleted from both external tomcat or embedded tomcat.
    112         Runtime rt = Runtime.getRuntime();
    113115        rt.exec("chmod -R 777 " + tmpTargetNativeDefaultFolderPath);
    114116    }
Note: See TracChangeset for help on using the changeset viewer.