E
- the element typeorg.refcodes.mixin.Disposable
, org.refcodes.exception.Exceptional<E>
, org.refcodes.mixin.Releaseable
ExceptionWatchdogImpl
public interface ExceptionWatchdog<E extends Exception>
extends org.refcodes.exception.Exceptional<E>, org.refcodes.mixin.Disposable, org.refcodes.mixin.Releaseable
ExceptionWatchdog
allows any number of threads to wait (sleep)
when calling catchException()
till the ExceptionWatchdog
is
fed with a next Exception
with throwException(Exception)
or
till all waiting threads are released by calling Releaseable.releaseAll()
.
Depending in the implementation, either just the current exception is passed
to the catchException()
method or a FIFO queue may be used passing
all queued Exception
instances to the catchException()
method as soon as a thread is awaiting an Exception
.
Modifier and Type | Method | Description |
---|---|---|
void |
catchException() |
This methods awaits an
Exception . |
E |
lastException() |
Returns the last exception which was pushed via
throwException(Exception) . |
void |
throwException(E aException) |
Passes an exception to the
ExceptionWatchdog notifying all
awaiting threads inside the catchException() method to be
provided with that Exception . |
void catchException() throws E extends Exception
Exception
. It waits (sleeps) until an
Exception
arises via throwException(Exception)
which is
then thrown by this catchException()
method. In case
Releaseable.releaseAll()
is being called, then all waiting threads are
continued without throwing any exception.
-------------------------------------------------------------------------
ATTENTION: In case waiting (sleeping) threads are released without
throwing an Exception
, then this means that the using instances
intends to shut down so that in such as case, no more calls to this
method are to be performed (are to be prevented), such looping threads
would lead to endless looping and cause consumption of calculation power.E lastException()
throwException(Exception)
. THis might not be the same as being
retrieved by catchException()
, as catchException()
might provide queued up Exception
instances till all
Exception
instances have been processed.lastException
in interface org.refcodes.exception.Exceptional<E extends Exception>
throwException(Exception)
;void throwException(E aException)
ExceptionWatchdog
notifying all
awaiting threads inside the catchException()
method to be
provided with that Exception
.aException
- The Exception
to be passed to the awaiting
threads inside the catchException()
method.Copyright © 2018. All rights reserved.