mirror of https://github.com/apache/activemq.git
https://issues.apache.org/activemq/browse/AMQ-2042 - added handling of 'no disk space' in default handler
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@882144 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
86e7d511a8
commit
0728ec9e75
|
@ -28,6 +28,8 @@ public class DefaultIOExceptionHandler implements IOExceptionHandler {
|
|||
.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) {
|
||||
|
@ -35,6 +37,17 @@ public class DefaultIOExceptionHandler implements IOExceptionHandler {
|
|||
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() {
|
||||
public void run() {
|
||||
|
@ -59,4 +72,20 @@ public class DefaultIOExceptionHandler implements IOExceptionHandler {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue