Class ThrowableHandler


  • public final class ThrowableHandler
    extends java.lang.Object
    A static singleton that handles processing throwables that otherwise would be ignored or dumped to System.err.
    Version:
    $Revision$
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  ThrowableHandler.Type
      Container for throwable types.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.util.List<ThrowableListener> listeners
      The list of listeners
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void add​(int type, java.lang.Throwable t)
      Add a throwable that is to be handled.
      static void add​(java.lang.Throwable t)
      Add a throwable that is to be handled with unknown type.
      static void addError​(java.lang.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​(java.lang.Throwable t)
      Add a throwable that is to be handled with warning type.
      protected static void fireOnThrowable​(int type, java.lang.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 java.util.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,
                                              java.lang.Throwable t)
        Fire onThrowable to all registered listeners.
        Parameters:
        type - The type off the throwable.
        t - Throwable
      • add

        public static void add​(int type,
                               java.lang.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​(java.lang.Throwable t)
        Add a throwable that is to be handled with unknown type.
        Parameters:
        t - Throwable to be handled.
      • addError

        public static void addError​(java.lang.Throwable t)
        Add a throwable that is to be handled with error type.
        Parameters:
        t - Throwable to be handled.
      • addWarning

        public static void addWarning​(java.lang.Throwable t)
        Add a throwable that is to be handled with warning type.
        Parameters:
        t - Throwable to be handled.