org.javabits.yar.InterruptedException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yar-api Show documentation
Show all versions of yar-api Show documentation
Yar API: provide the main interfaces to manipulate the registry
The newest version!
package org.javabits.yar;
/**
* This class is a unchecked wrapper of the {@link java.lang.InterruptedException}.
* From {@link java.lang.InterruptedException} documentation:
* Thrown when a thread is waiting, sleeping, or otherwise occupied,
* and the thread is interrupted, either before or during the activity.
* Occasionally a method may wish to test whether the current
* thread has been interrupted, and if so, to immediately throw
* this exception. The following code can be used to achieve
* this effect:
*
* if (Thread.interrupted()) // Clears interrupted status!
* throw new InterruptedException();
*
*
* Date: 5/17/13
*
* @author Romain Gilles
* @see java.lang.InterruptedException
*/
public class InterruptedException extends ConcurrentException {
private static final long serialVersionUID = 1L;
/**
* Constructs an InterruptedException
with no detail message.
*
* @param cause original {@code InterruptedException
*/
public InterruptedException(java.lang.InterruptedException cause) {
super(cause);
}
/**
* Constructs an InterruptedException
with the
* specified detail message.
*
* @param message the detail message.
* @param cause original {@code InterruptedException}
*/
public InterruptedException(String message, java.lang.InterruptedException cause) {
super(message, cause);
}
/**
* Re-interrupt the current thread and constructs an InterruptedException
* with the specified detail message.
*
* @param message the detail message.
* @param cause original {@code InterruptedException}
*/
public static InterruptedException newInterruptedException(String message, java.lang.InterruptedException cause) {
Thread.currentThread().interrupt();
return new InterruptedException(message, cause);
}
/**
* Re-interrupt the current thread and constructs an InterruptedException
* with no detail message.
*
* @param cause original {@code InterruptedException
*/
public static InterruptedException newInterruptedException(java.lang.InterruptedException cause) {
Thread.currentThread().interrupt();
return new InterruptedException(cause);
}
}