* Send event.
*/
private void sendEvent(ConnectionEvent event) {
synchronized (listeners) {
for (Iterator i = listeners.iterator(); i.hasNext();) {
ConnectionEventListener listener = (ConnectionEventListener) i.next();
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;
default:
// Unknown event, skip
}
}