public class SourcedInterruptedException extends InterruptedException implements ExceptionUtils.CustomStackTrace
InterruptedException
, which may include the source, see getInterruptSource()
.
This exception may be created directly where getCause()
returns null
,
or by propagating an existing InterruptedException
as returned by getCause()
.
Constructor and Description |
---|
SourcedInterruptedException(InterruptedException cause,
Throwable interruptSource) |
SourcedInterruptedException(String message,
InterruptedException cause,
Throwable interruptSource) |
Modifier and Type | Method and Description |
---|---|
void |
dumpCauseStack(PrintStream s,
String causeStr,
int causeDepth)
Custom non-iterative stack dump
|
InterruptedException |
getCause()
Returns the propagated
InterruptedException , i.e. |
Throwable |
getInterruptSource()
Returns the source of the
Thread.interrupt() call if known,
otherwise null is returned. |
void |
printStackTrace(PrintStream s)
Custom
printStackTrace method, similar to Throwable.printStackTrace(PrintStream) . |
String |
toString() |
static InterruptedException |
wrap(InterruptedException ie)
Wraps the given
InterruptedException into a SourcedInterruptedException
if it is not yet of the desired type and
if the current thread if a InterruptSource , i.e. |
static InterruptedException |
wrap(InterruptedException ie,
InterruptSource source)
Wraps the given
InterruptedException into a SourcedInterruptedException
if it is not yet of the same type and if source is not null . |
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, setStackTrace
public SourcedInterruptedException(String message, InterruptedException cause, Throwable interruptSource)
message
- mandatory message of this exceptioncause
- optional propagated causeinterruptSource
- optional propagated source of Thread.interrupt()
callpublic SourcedInterruptedException(InterruptedException cause, Throwable interruptSource)
cause
- mandatory propagated causeinterruptSource
- optional propagated source of Thread.interrupt()
callpublic static InterruptedException wrap(InterruptedException ie)
InterruptedException
into a SourcedInterruptedException
if it is not yet of the desired type and
if the current thread if a InterruptSource
, i.e. the source is known.
Otherwise the given InterruptedException
instance is returned.
In case method is creating a new wrapping instance,
InterruptSource.clearInterruptSource()
is being issued.
ie
- the to be wrapped InterruptedException
public static InterruptedException wrap(InterruptedException ie, InterruptSource source)
InterruptedException
into a SourcedInterruptedException
if it is not yet of the same type and if source
is not null
.
Otherwise the given InterruptedException
instance is returned.
In case method is creating a new wrapping instance,
InterruptSource.clearInterruptSource()
is being issued.
ie
- the to be wrapped InterruptedException
source
- the InterruptSource
public final Throwable getInterruptSource()
Thread.interrupt()
call if known,
otherwise null
is returned.public InterruptedException getCause()
InterruptedException
, i.e. the cause of this exception,
or null
if not applicable.
public final void dumpCauseStack(PrintStream s, String causeStr, int causeDepth)
ExceptionUtils.CustomStackTrace
dumpCauseStack
in interface ExceptionUtils.CustomStackTrace
public final void printStackTrace(PrintStream s)
ExceptionUtils.CustomStackTrace
printStackTrace
method, similar to Throwable.printStackTrace(PrintStream)
.printStackTrace
in interface ExceptionUtils.CustomStackTrace
printStackTrace
in class Throwable