Example usage for org.apache.commons.pool2 SwallowedExceptionListener onSwallowException

List of usage examples for org.apache.commons.pool2 SwallowedExceptionListener onSwallowException

Introduction

In this page you can find the example usage for org.apache.commons.pool2 SwallowedExceptionListener onSwallowException.

Prototype

void onSwallowException(Exception e);

Source Link

Document

This method is called every time the implementation unavoidably swallows an exception.

Usage

From source file:JDBCPool.dbcp.demo.sourcecode.BaseGenericObjectPool.java

/**
 * Swallows an exception and notifies the configured listener for swallowed
 * exceptions queue.//  www.  j  a v a2s  .  c o  m
 *
 * @param e exception to be swallowed
 */
final void swallowException(Exception e) {
    SwallowedExceptionListener listener = getSwallowedExceptionListener();

    if (listener == null) {
        return;
    }

    try {
        listener.onSwallowException(e);
    } catch (OutOfMemoryError oome) {
        throw oome;
    } catch (VirtualMachineError vme) {
        throw vme;
    } catch (Throwable t) {
        // Ignore. Enjoy the irony.
    }
}