com.addc.commons.queue.DispatcherException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of addc-queues Show documentation
Show all versions of addc-queues Show documentation
The addc-queues library supplies support for internal persistent queues using an optional DERBY database for storage.
The newest version!
package com.addc.commons.queue;
/**
* The DispatcherException is thrown by {@link PayloadDispatcher} in the case of
* an internal error that should either abort or slow down the {@link PersistingQueueReader}
*/
public class DispatcherException extends Exception {
private static final long serialVersionUID= -1950460981591235488L;
private final boolean recoverable;
private final Long retryDelay;
/**
* Create a recoverable DispatcherException
* @param message The message
* @param cause The cause
*/
public DispatcherException(String message, Throwable cause) {
this(message, cause, true, null);
}
/**
* Create aDispatcherException
* @param message The message
* @param cause The cause
* @param recoverable Flag indicating whether the error is recoverable
* @param retryDelay If the message is recoverable, the recommended delay before retrying
*/
public DispatcherException(String message, Throwable cause, boolean recoverable, Long retryDelay) {
super(message, cause);
this.recoverable= recoverable;
this.retryDelay= retryDelay;
}
/**
* Is the error recoverable
* @return true
if the error is recoverable
*/
public boolean isRecoverable() {
return recoverable;
}
/**
* Get the retry delay (may be null)
* @return The retry delay
*/
public Long getRetryDelay() {
return retryDelay;
}
@Override
public String getMessage() {
StringBuilder sb= new StringBuilder(super.getMessage());
sb.append(" recoverable=").append(recoverable).append(" retryDelay=").append(retryDelay);
return sb.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy