|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.pelzer.util.Absorb
public class Absorb
Utility class to absorb exceptions in certain cases such as sleeping and in catch blocks.
| Nested Class Summary | |
|---|---|
static interface |
Absorb.IgnoredExceptionListener
|
| Constructor Summary | |
|---|---|
Absorb()
|
|
| Method Summary | |
|---|---|
static void |
addIgnoredExceptionListener(Absorb.IgnoredExceptionListener listener)
|
static void |
ignore(Throwable ignored)
Not an exactly perfect name, but basically takes the given exception and logs it under this class's logger, which is silenced by default. |
static void |
removeIgnoredExceptionListener(Absorb.IgnoredExceptionListener listener)
|
static void |
rethrow(Throwable ex)
Wraps the passed exception and then rethrows it wrapped in a runtime exception. |
static void |
sleep(long milliseconds)
Shortcut to #sleep(TimeUnit.MILLISECONDS, long) |
static void |
sleep(TimeUnit timeUnit,
long units)
Sleeps in exactly the same way as calling timeUnit.sleep(units), but absorbs any InterruptedException
and exits normally. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Absorb()
| Method Detail |
|---|
public static void sleep(TimeUnit timeUnit,
long units)
timeUnit.sleep(units), but absorbs any InterruptedException
and exits normally.
public static void sleep(long milliseconds)
#sleep(TimeUnit.MILLISECONDS, long)
public static void ignore(Throwable ignored)
catch, but you don't have to write a bunch of boilerplate
to do something with the tossed exception.
public static void addIgnoredExceptionListener(Absorb.IgnoredExceptionListener listener)
public static void removeIgnoredExceptionListener(Absorb.IgnoredExceptionListener listener)
public static void rethrow(Throwable ex)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||