JBoss Common Classes 2.2.17.GA

org.jboss.util
Class ThrowableHandler

java.lang.Object
  extended by org.jboss.util.ThrowableHandler

public final class ThrowableHandler
extends Object

A static singleton that handles processing throwables that otherwise would be ignored or dumped to System.err.

Version:
$Revision: 2787 $
Author:
Jason Dillon

Nested Class Summary
static interface ThrowableHandler.Type
          Container for throwable types.
 
Field Summary
protected static List<ThrowableListener> listeners
          The list of listeners
 
Constructor Summary
ThrowableHandler()
           
 
Method Summary
static void add(int type, Throwable t)
          Add a throwable that is to be handled.
static void add(Throwable t)
          Add a throwable that is to be handled with unknown type.
static void addError(Throwable t)
          Add a throwable that is to be handled with error type.
static void addThrowableListener(ThrowableListener listener)
          Add a ThrowableListener to the listener list.
static void addWarning(Throwable t)
          Add a throwable that is to be handled with warning type.
protected static void fireOnThrowable(int type, Throwable t)
          Fire onThrowable to all registered listeners.
static void removeThrowableListener(ThrowableListener listener)
          Remove a ThrowableListener from the listener list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected static List<ThrowableListener> listeners
The list of listeners

Constructor Detail

ThrowableHandler

public ThrowableHandler()
Method Detail

addThrowableListener

public static void addThrowableListener(ThrowableListener listener)
Add a ThrowableListener to the listener list. Listener is added only if if it is not already in the list.

Parameters:
listener - ThrowableListener to add to the list.

removeThrowableListener

public static void removeThrowableListener(ThrowableListener listener)
Remove a ThrowableListener from the listener list.

Parameters:
listener - ThrowableListener to remove from the list.

fireOnThrowable

protected static void fireOnThrowable(int type,
                                      Throwable t)
Fire onThrowable to all registered listeners.

Parameters:
type - The type off the throwable.
t - Throwable

add

public static void add(int type,
                       Throwable t)
Add a throwable that is to be handled.

Parameters:
type - The type off the throwable.
t - Throwable to be handled.

add

public static void add(Throwable t)
Add a throwable that is to be handled with unknown type.

Parameters:
t - Throwable to be handled.

addError

public static void addError(Throwable t)
Add a throwable that is to be handled with error type.

Parameters:
t - Throwable to be handled.

addWarning

public static void addWarning(Throwable t)
Add a throwable that is to be handled with warning type.

Parameters:
t - Throwable to be handled.

JBoss Common Classes 2.2.17.GA

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.