Package com.jogamp.common.util
Class SourcedInterruptedException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.InterruptedException
-
- com.jogamp.common.util.SourcedInterruptedException
-
- All Implemented Interfaces:
ExceptionUtils.CustomStackTrace,Serializable
public class SourcedInterruptedException extends InterruptedException implements ExceptionUtils.CustomStackTrace
InterruptedException, which may include the source, seegetInterruptSource().This exception may be created directly where
getCause()returnsnull, or by propagating an existingInterruptedExceptionas returned bygetCause().- Since:
- 2.3.2
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SourcedInterruptedException(InterruptedException cause, Throwable interruptSource)SourcedInterruptedException(String message, InterruptedException cause, Throwable interruptSource)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InterruptedExceptiongetCause()Returns the propagatedInterruptedException, i.e.ThrowablegetInterruptSource()Returns the source of theThread.interrupt()call if known, otherwisenullis returned.voidprintCauseStack(PrintStream s, String causeStr, int causeIdx, int stackDepth)voidprintStackTrace(PrintStream s, int causeDepth, int stackDepth)CustomprintStackTracemethod, similar toThrowable#printStackTrace(PrintStream, int, int).StringtoString()static InterruptedExceptionwrap(InterruptedException ie)Wraps the givenInterruptedExceptioninto aSourcedInterruptedExceptionif it is not yet of the desired type and if the current thread if aInterruptSource, i.e.static InterruptedExceptionwrap(InterruptedException ie, InterruptSource source)Wraps the givenInterruptedExceptioninto aSourcedInterruptedExceptionif it is not yet of the same type and ifsourceis notnull.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Constructor Detail
-
SourcedInterruptedException
public SourcedInterruptedException(String message, InterruptedException cause, Throwable interruptSource)
- Parameters:
message- mandatory message of this exceptioncause- optional propagated causeinterruptSource- optional propagated source ofThread.interrupt()call
-
SourcedInterruptedException
public SourcedInterruptedException(InterruptedException cause, Throwable interruptSource)
- Parameters:
cause- mandatory propagated causeinterruptSource- optional propagated source ofThread.interrupt()call
-
-
Method Detail
-
wrap
public static InterruptedException wrap(InterruptedException ie)
Wraps the givenInterruptedExceptioninto aSourcedInterruptedExceptionif it is not yet of the desired type and if the current thread if aInterruptSource, i.e. the source is known.Otherwise the given
InterruptedExceptioninstance is returned.In case method is creating a new wrapping instance,
InterruptSource.clearInterruptSource()is being issued.- Parameters:
ie- the to be wrappedInterruptedException
-
wrap
public static InterruptedException wrap(InterruptedException ie, InterruptSource source)
Wraps the givenInterruptedExceptioninto aSourcedInterruptedExceptionif it is not yet of the same type and ifsourceis notnull.Otherwise the given
InterruptedExceptioninstance is returned.In case method is creating a new wrapping instance,
InterruptSource.clearInterruptSource()is being issued.- Parameters:
ie- the to be wrappedInterruptedExceptionsource- theInterruptSource
-
getInterruptSource
public final Throwable getInterruptSource()
Returns the source of theThread.interrupt()call if known, otherwisenullis returned.
-
getCause
public InterruptedException getCause()
Returns the propagatedInterruptedException, i.e. the cause of this exception, ornullif not applicable.
-
printCauseStack
public final void printCauseStack(PrintStream s, String causeStr, int causeIdx, int stackDepth)
Description copied from interface:ExceptionUtils.CustomStackTrace- Specified by:
printCauseStackin interfaceExceptionUtils.CustomStackTrace- Parameters:
s- output streamcauseStr- the cause titlecauseIdx- the cause index over all causes known by callerstackDepth- the maximum depth for stack entries, or-1for all
-
printStackTrace
public final void printStackTrace(PrintStream s, int causeDepth, int stackDepth)
Description copied from interface:ExceptionUtils.CustomStackTraceCustomprintStackTracemethod, similar toThrowable#printStackTrace(PrintStream, int, int).- Specified by:
printStackTracein interfaceExceptionUtils.CustomStackTrace- Parameters:
s- output streamcauseDepth- the maximum depth for causes, or-1for allstackDepth- the maximum depth for stack entries, or-1for all
-
-