public class SampleConnectionEventListener
extends java.lang.Object
implements javax.resource.spi.ConnectionEventListener
javax.resource.spi.ConnectionEventListener interface.
It keeps a vector of ConnectionEventListener registered with a ManagedConnection.
When its sendEvent(int, Exception, Object) is invoked, it loops through the vector
and sends the event to all registered ConnectionEventListener.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
COPYRIGHT
Copyright statement.
|
| Constructor and Description |
|---|
SampleConnectionEventListener(javax.resource.spi.ManagedConnection mc)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionListener(javax.resource.spi.ConnectionEventListener l)
Adds a connection listener to the existing connection listener
|
void |
connectionClosed(javax.resource.spi.ConnectionEvent arg1)
Connection closed.
|
void |
connectionErrorOccurred(javax.resource.spi.ConnectionEvent arg1)
The
connectionErrorOccurred method. |
void |
localTransactionCommitted(javax.resource.spi.ConnectionEvent arg1)
The
localTransactionCommitted method. |
void |
localTransactionRolledback(javax.resource.spi.ConnectionEvent arg1)
The
localTransactionRolledback method. |
void |
localTransactionStarted(javax.resource.spi.ConnectionEvent arg1)
The
localTransactionStarted method. |
void |
removeConnectionListener(javax.resource.spi.ConnectionEventListener l)
Removes a connection listener
|
void |
sendEvent(int eventType,
java.lang.Exception ex,
java.lang.Object connectionHandle)
Sends an event
|
public static final java.lang.String COPYRIGHT
public SampleConnectionEventListener(javax.resource.spi.ManagedConnection mc)
managedConnection - The managed connection provided by
the application server.public void connectionClosed(javax.resource.spi.ConnectionEvent arg1)
connectionClosed in interface javax.resource.spi.ConnectionEventListenerarg1 - The connection eventpublic void connectionErrorOccurred(javax.resource.spi.ConnectionEvent arg1)
connectionErrorOccurred method. It does nothing in the current implementation.connectionErrorOccurred in interface javax.resource.spi.ConnectionEventListenerarg1 - The connection eventpublic void localTransactionCommitted(javax.resource.spi.ConnectionEvent arg1)
localTransactionCommitted method. It does nothing in current implementation.localTransactionCommitted in interface javax.resource.spi.ConnectionEventListenerarg1 - The connection eventpublic void localTransactionRolledback(javax.resource.spi.ConnectionEvent arg1)
localTransactionRolledback method. It does nothing in current implementation.localTransactionRolledback in interface javax.resource.spi.ConnectionEventListenerarg1 - The connection eventpublic void localTransactionStarted(javax.resource.spi.ConnectionEvent arg1)
localTransactionStarted method. It does nothing in current implementation.localTransactionStarted in interface javax.resource.spi.ConnectionEventListenerarg1 - The connection eventpublic void addConnectionListener(javax.resource.spi.ConnectionEventListener l)
javax.resource.spi.ConnectionEventListener - The listener that needs to be listened to.public void removeConnectionListener(javax.resource.spi.ConnectionEventListener l)
javax.resource.spi.ConnectionEventListener - The connection event listener that to be removed.public void sendEvent(int eventType,
java.lang.Exception ex,
java.lang.Object connectionHandle)
eventType - The event typeex - The ExceptionconnectionHandle - The connection handle