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,12 +28,25 @@ 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) {
|
||||
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 @@ 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