Author: veithen
Date: Sat Dec 17 09:54:55 2011
New Revision: 1215445

URL: http://svn.apache.org/viewvc?rev=1215445&view=rev
Log:
AXIOM-377: Ensure that files are removed from the shutdown hook when they are 
deleted.

Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartContentOnFile.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/DataHandlerExtImpl.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/LifecycleManagerImpl.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartContentOnFile.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartContentOnFile.java?rev=1215445&r1=1215444&r2=1215445&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartContentOnFile.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartContentOnFile.java
 Sat Dec 17 09:54:55 2011
@@ -100,6 +100,5 @@ class PartContentOnFile extends PartCont
 
     void destroy() throws IOException {
         manager.delete(fileAccessor.getFile());
-        // TODO: recover the shutdown hook code from DataHandlerExtImpl
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/DataHandlerExtImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/DataHandlerExtImpl.java?rev=1215445&r1=1215444&r2=1215445&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/DataHandlerExtImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/DataHandlerExtImpl.java
 Sat Dec 17 09:54:55 2011
@@ -79,15 +79,6 @@ public class DataHandlerExtImpl extends 
                if(file!=null){
                        //Invoke delete from LifecycleManager
                        manager.delete(file);
-                       //If file was registered with VMShutdown hook
-                       //lets remove it from the list to be deleted on VMExit.
-                       VMShutdownHook hook =VMShutdownHook.hook();
-                       if(hook.isRegistered()){
-                               hook.remove(file);
-                       }
-                       if(log.isDebugEnabled()){
-                               log.debug("File Purged and removed from 
Shutdown Hook Collection");
-                       }
                }else{
                        if(log.isDebugEnabled()){
                                log.debug("DataSource is not a 
CachedFileDataSource, Unable to Purge.");

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/LifecycleManagerImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/LifecycleManagerImpl.java?rev=1215445&r1=1215444&r2=1215445&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/LifecycleManagerImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/lifecycle/impl/LifecycleManagerImpl.java
 Sat Dec 17 09:54:55 2011
@@ -95,6 +95,15 @@ public class LifecycleManagerImpl implem
                 if(log.isDebugEnabled()){
                     log.debug("delete() successful");
                 }
+                //If file was registered with VMShutdown hook
+                //lets remove it from the list to be deleted on VMExit.
+                VMShutdownHook hook =VMShutdownHook.hook();
+                if(hook.isRegistered()){
+                    hook.remove(file);
+                }
+                if(log.isDebugEnabled()){
+                    log.debug("File Purged and removed from Shutdown Hook 
Collection");
+                }
             }else{
                 if(log.isDebugEnabled()){
                     log.debug("Cannot delete file, set to delete on VM 
shutdown");


Reply via email to