Example usage for javax.naming NamingException getSuppressed

List of usage examples for javax.naming NamingException getSuppressed

Introduction

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

Prototype

public final synchronized Throwable[] getSuppressed() 

Source Link

Document

Returns an array containing all of the exceptions that were suppressed, typically by the try -with-resources statement, 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");
    }//from   ww  w. ja  v a2 s  .  c o m
    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();
    }
}