Example usage for javax.resource.spi ConnectionEvent CONNECTION_ERROR_OCCURRED

List of usage examples for javax.resource.spi ConnectionEvent CONNECTION_ERROR_OCCURRED

Introduction

In this page you can find the example usage for javax.resource.spi ConnectionEvent CONNECTION_ERROR_OCCURRED.

Prototype

int CONNECTION_ERROR_OCCURRED

To view the source code for javax.resource.spi ConnectionEvent CONNECTION_ERROR_OCCURRED.

Click Source Link

Document

Event notification that an error occurred on the connection.

Usage

From source file:org.eclipse.ecr.core.storage.sql.ra.ManagedConnectionImpl.java

protected void sendErrorEvent(ConnectionImpl connection, Exception cause) {
    sendEvent(ConnectionEvent.CONNECTION_ERROR_OCCURRED, connection, cause);
}

From source file:org.eclipse.ecr.core.storage.sql.ra.ManagedConnectionImpl.java

/**
 * Notifies the application server, through the
 * {@link ConnectionEventListener}s it has registered with us, of what
 * happens with this connection.//from  w w w . j  a  v  a  2 s . co  m
 */
private void sendEvent(ConnectionEvent event) {
    for (Object object : listeners.getListeners()) {
        ConnectionEventListener listener = (ConnectionEventListener) object;
        switch (event.getId()) {
        case ConnectionEvent.CONNECTION_CLOSED:
            listener.connectionClosed(event);
            break;
        case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
            listener.localTransactionStarted(event);
            break;
        case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
            listener.localTransactionCommitted(event);
            break;
        case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
            listener.localTransactionRolledback(event);
            break;
        case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
            listener.connectionErrorOccurred(event);
            break;
        }
    }
}

From source file:org.nuxeo.ecm.core.jca.JCAManagedConnection.java

/**
 * Send event.//w ww.j  a  v a2 s.  co m
 */
private void sendEvent(ConnectionEvent event) {
    Object[] listenersArray = listeners.getListenersCopy();
    for (Object object : listenersArray) {
        ConnectionEventListener listener = (ConnectionEventListener) object;

        switch (event.getId()) {
        case ConnectionEvent.CONNECTION_CLOSED:
            listener.connectionClosed(event);
            break;
        case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
            listener.connectionErrorOccurred(event);
            break;
        case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
            listener.localTransactionCommitted(event);
            break;
        case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
            listener.localTransactionRolledback(event);
            break;
        case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
            listener.localTransactionStarted(event);
            break;
        }
    }
}

From source file:org.nuxeo.ecm.core.jca.JCAManagedConnection.java

/**
 * Send connection error event./*from  w w  w  .  ja  v a2s  .c o  m*/
 */
public void sendErrorEvent(JCAConnection handle, Exception cause) {
    sendEvent(ConnectionEvent.CONNECTION_ERROR_OCCURRED, handle, cause);
}

From source file:pl.psnc.synat.dsa.DataStorageManagedConnection.java

/**
 * Releases connection. Some error occurred.
 * /*  ww w.ja  v  a2  s.c  o  m*/
 * @param ex
 *            exception associated with the error
 */
public void release(Exception ex) {
    logger.debug("releasing with error: " + ex);
    sender.sendEvent(ConnectionEvent.CONNECTION_ERROR_OCCURRED, ex, connection);
}