activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r882144 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java
Date Thu, 19 Nov 2009 13:50:46 GMT
Author: dejanb
Date: Thu Nov 19 13:50:46 2009
New Revision: 882144

URL: http://svn.apache.org/viewvc?rev=882144&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2042 - added handling of 'no disk space' in
default handler

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java?rev=882144&r1=882143&r2=882144&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DefaultIOExceptionHandler.java
Thu Nov 19 13:50:46 2009
@@ -28,12 +28,25 @@
             .getLog(DefaultIOExceptionHandler.class);
     private BrokerService broker;
     private boolean ignoreAllErrors = false;
+    private boolean ignoreNoSpaceErrors = true;
+    private String noSpaceMessage = "space";
 
     public void handle(IOException exception) {
         if (ignoreAllErrors) {
             LOG.info("Ignoring IO exception, " + exception, exception);
             return;
         }
+        
+        if (ignoreNoSpaceErrors) {
+            Throwable cause = exception;
+            while (cause != null && cause instanceof IOException) {
+                if (cause.getMessage().contains(noSpaceMessage)) {
+                    LOG.info("Ignoring no space left exception, " + exception, exception);
+                    return;
+                }
+                cause = cause.getCause();
+            }
+        }
 
         LOG.info("Stopping the broker due to IO exception, " + exception, exception);
         new Thread() {
@@ -59,4 +72,20 @@
         this.ignoreAllErrors = ignoreAllErrors;
     }
 
+    public boolean isIgnoreNoSpaceErrors() {
+        return ignoreNoSpaceErrors;
+    }
+
+    public void setIgnoreNoSpaceErrors(boolean ignoreNoSpaceErrors) {
+        this.ignoreNoSpaceErrors = ignoreNoSpaceErrors;
+    }
+
+    public String getNoSpaceMessage() {
+        return noSpaceMessage;
+    }
+
+    public void setNoSpaceMessage(String noSpaceMessage) {
+        this.noSpaceMessage = noSpaceMessage;
+    }
+
 }



Mime
View raw message