Example usage for java.lang ThreadDeath printStackTrace

List of usage examples for java.lang ThreadDeath printStackTrace

Introduction

In this page you can find the example usage for java.lang ThreadDeath printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:EventDispatcher.java

protected static void dispatchEvent(final Dispatcher dispatcher, final Object[] ll, final Object evt) {
    ThreadDeath td = null;//www .ja  v  a  2 s  .c o  m
    try {
        for (int i = 0; i < ll.length; i++) {
            try {
                Object l;
                synchronized (ll) {
                    l = ll[i];
                    if (l == null)
                        continue;
                    ll[i] = null;
                }
                dispatcher.dispatch(l, evt);
            } catch (ThreadDeath t) {
                // Keep delivering messages but remember to throw later.
                td = t;
            } catch (Throwable t) {
                t.printStackTrace();
            }
        }
    } catch (ThreadDeath t) {
        // Remember to throw later.
        td = t;
    } catch (Throwable t) {
        if (ll[ll.length - 1] != null)
            dispatchEvent(dispatcher, ll, evt);
        t.printStackTrace();
    }
    if (td != null)
        throw td;
}