
com.pippsford.util.RuntimeInterruptedException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-utils Show documentation
Show all versions of common-utils Show documentation
Code that seems to me to have utility across multiple projects
The newest version!
package com.pippsford.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Correct handling of InterruptedExceptions is often to run all finalizers and terminate the process. This happens naturally when an unchecked exception is
* raised. Specific handling for InterruptedExceptions can lead to a bloat in boiler-plate code. Converting the exception to a runtime exception can provide
* the correct handling without the need for specific code.
*
* Suggested usage of this class is:
*
* try {
* ... code ..
* } catch ( InterruptedException ie ) {
* throw new RuntimeInterruptedException(ie);
* }
*
*
* @author Simon Greatrix on 2019-05-07.
*/
public class RuntimeInterruptedException extends RuntimeException {
private static final Logger logger = LoggerFactory.getLogger(RuntimeInterruptedException.class);
public RuntimeInterruptedException(InterruptedException cause) {
super(cause);
logger.error("Process was interrupted", cause);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy