I am trying to do some cleanup tasks in the DesignerHook shutdown method.
Basically trying to delete some temporary files that were created in my custom component.
Following is what I want to do -
String userHomeDirectory = System.getProperty(“user.home”);
File dir = new File(userHomeDirectory);
FileFilter fileFilter = new WildcardFileFilter(".mymodule*");
File[] files = dir.listFiles(fileFilter);
//delete the files that start with name above
for (int i = 0; i < files.length; i++) {
try {
FileUtils.deleteDirectory(files[i]);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
This works perfectly when written in ClientHook shutdown method.
However is not working from DesignerHook shutdown method.
When some one runs the component from designer, temporary files get created but I believe Designer Hook shutdown is not getting called and temporary files are not deleted.
Tested this on 7.9.4 , 7.9.5 and 7.9.6
Java version 7.8.0_161
Appreciate any help in this regard.