All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pippsford.util.RuntimeInterruptedException Maven / Gradle / Ivy

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