Example usage for javax.naming NamingException addSuppressed

List of usage examples for javax.naming NamingException addSuppressed

Introduction

In this page you can find the example usage for javax.naming NamingException addSuppressed.

Prototype

public final synchronized void addSuppressed(Throwable exception) 

Source Link

Document

Appends the specified exception to the exceptions that were suppressed in order to deliver this exception.

Usage

From source file:org.nuxeo.runtime.jtajca.NuxeoContainer.java

protected static void uninstall() throws NamingException {
    if (installContext == null) {
        throw new RuntimeException("Nuxeo container not installed");
    }//w  ww . j ava2 s  .c om
    try {
        NamingException errors = new NamingException("Cannot shutdown connection managers");
        for (ConnectionManagerWrapper cm : connectionManagers.values()) {
            try {
                cm.dispose();
            } catch (RuntimeException cause) {
                errors.addSuppressed(cause);
            }
        }
        if (errors.getSuppressed().length > 0) {
            log.error("Cannot shutdown some pools", errors);
            throw errors;
        }
    } finally {
        log.trace("Uninstalling nuxeo container", installContext);
        installContext = null;
        rootContext = null;
        tm = null;
        tmRecoverable = null;
        tmSynchRegistry = null;
        ut = null;
        connectionManagers.clear();
    }
}