Package jakarta.resource.spi
Class ConnectionEvent
java.lang.Object
java.util.EventObject
jakarta.resource.spi.ConnectionEvent
- All Implemented Interfaces:
Serializable
The ConnectionEvent class provides information about the source of
a connection related event.A ConnectionEvent instance contains the
following information:
- Type of the connection event
- ManagedConnection instance that generated the connection event. A ManagedConnection instance is returned from the method ConnectionEvent.getSource.
- Connection handle associated with the ManagedConnection instance; required for the CONNECTION_CLOSED event and optional for the other event types.
- Optionally, an exception indicating the connection related error. Note that exception is used for CONNECTION_ERROR_OCCURRED.
This class defines following types of event notifications:
- CONNECTION_CLOSED
- LOCAL_TRANSACTION_STARTED
- LOCAL_TRANSACTION_COMMITTED
- LOCAL_TRANSACTION_ROLLEDBACK
- CONNECTION_ERROR_OCCURRED
- Version:
- 0.5
- Author:
- Rahul Sharma
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Event notification that an application component has closed the connectionstatic final int
Event notification that an error occurred on the connection.protected int
Type of the eventstatic final int
Event notification that a Resource Manager Local Transaction was committed on the connectionstatic final int
Event notification that a Resource Manager Local Transaction was rolled back on the connectionstatic final int
Event notification that a Resource Manager Local Transaction was started on the connectionFields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionConnectionEvent
(ManagedConnection source, int eid) Construct a ConnectionEvent object.ConnectionEvent
(ManagedConnection source, int eid, Exception exception) Construct a ConnectionEvent object. -
Method Summary
Modifier and TypeMethodDescriptionGet the connection handle associated with the Managed Connection instance.Get the exception.int
getId()
Get the type of eventvoid
setConnectionHandle
(Object connectionHandle) Set the connection handle.Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
CONNECTION_CLOSED
public static final int CONNECTION_CLOSEDEvent notification that an application component has closed the connection- See Also:
-
LOCAL_TRANSACTION_STARTED
public static final int LOCAL_TRANSACTION_STARTEDEvent notification that a Resource Manager Local Transaction was started on the connection- See Also:
-
LOCAL_TRANSACTION_COMMITTED
public static final int LOCAL_TRANSACTION_COMMITTEDEvent notification that a Resource Manager Local Transaction was committed on the connection- See Also:
-
LOCAL_TRANSACTION_ROLLEDBACK
public static final int LOCAL_TRANSACTION_ROLLEDBACKEvent notification that a Resource Manager Local Transaction was rolled back on the connection- See Also:
-
CONNECTION_ERROR_OCCURRED
public static final int CONNECTION_ERROR_OCCURREDEvent notification that an error occurred on the connection. This event indicates that the ManagedConnection instance is now invalid and unusable.- See Also:
-
id
protected int idType of the event
-
-
Constructor Details
-
ConnectionEvent
Construct a ConnectionEvent object. Exception defaults to null.- Parameters:
source
- ManagedConnection that is the source of the eventeid
- type of the Connection event
-
ConnectionEvent
Construct a ConnectionEvent object.- Parameters:
source
- ManagedConnection that is the source of the eventexception
- exception about to be thrown to the applicationeid
- type of the Connection event
-
-
Method Details
-
getConnectionHandle
Get the connection handle associated with the Managed Connection instance. Used for CONNECTION_CLOSED event.- Returns:
- the connection handle. May be null
-
setConnectionHandle
Set the connection handle. Used for CONNECTION_CLOSED event- Parameters:
connectionHandle
- to set
-
getException
Get the exception. May be null.- Returns:
- the exception about to be thrown.
-
getId
public int getId()Get the type of event- Returns:
- The type of the event
-