activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r560693 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Date Sun, 29 Jul 2007 08:54:50 GMT
Author: rajdavies
Date: Sun Jul 29 01:54:49 2007
New Revision: 560693

URL: http://svn.apache.org/viewvc?view=rev&rev=560693
Log:
Fix for http://issues.apache.org/activemq/browse/AMQ-1294

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?view=diff&rev=560693&r1=560692&r2=560693
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Sun Jul 29 01:54:49 2007
@@ -1063,12 +1063,27 @@
      */
     public synchronized Store getTempDataStore(){
         if(tempDataStore==null){
-            String name=getTmpDataDirectory().getPath();
+            boolean result=true;
+            boolean empty=true;
             try{
-                log.info("About to delete any non-persistent messages that may have overflowed
to disk ...");
-                StoreFactory.delete(name);
-                log.info("Successfully deleted temporary storage");
-                tempDataStore=StoreFactory.open(name,"rw");
+                File directory=getTmpDataDirectory();
+                if(directory.exists()&&directory.isDirectory()){
+                    File[] files=directory.listFiles();
+                    if(files!=null&&files.length>0){
+                        empty=false;
+                        for(int i=0;i<files.length;i++){
+                            File file=files[i];
+                            if(!file.isDirectory()){
+                                result&=file.delete();
+                            }
+                        }
+                    }
+                }
+                if(!empty){
+                    String str=result?"Successfully deleted":"Failed to delete";
+                    log.info(str+" temporary storage");
+                }
+                tempDataStore=StoreFactory.open(getTmpDataDirectory().getPath(),"rw");
             }catch(IOException e){
                 throw new RuntimeException(e);
             }



Mime
View raw message