Class ConnectionEvent

  • All Implemented Interfaces:
    java.io.Serializable

    public class ConnectionEvent
    extends java.util.EventObject
    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
    See Also:
    ConnectionEventListener, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int CONN_HANDLE_IDX  
      static int CONNECTION_CLOSED
      Event notification that an application component has closed the connection
      static int CONNECTION_ERROR_OCCURRED
      Event notification that an error occurred on the connection.
      private java.lang.Object connectionHandle  
      private java.lang.Exception e
      Exception associated with the ConnectionEvent instance.
      private static int EXCEPTION_IDX  
      protected int id
      Type of the event
      private static int ID_IDX  
      static int LOCAL_TRANSACTION_COMMITTED
      Event notification that a Resource Manager Local Transaction was committed on the connection
      static int LOCAL_TRANSACTION_ROLLEDBACK
      Event notification that a Resource Manager Local Transaction was rolled back on the connection
      static int LOCAL_TRANSACTION_STARTED
      Event notification that a Resource Manager Local Transaction was started on the connection
      private static java.io.ObjectStreamField[] serialPersistentFields
      Persistence field information
      private static long serialVersionUID
      Serial version uid
      • Fields inherited from class java.util.EventObject

        source
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getConnectionHandle()
      Get the connection handle associated with the Managed Connection instance.
      java.lang.Exception getException()
      Get the exception.
      int getId()
      Get the type of event
      private void readObject​(java.io.ObjectInputStream ois)
      Read object
      void setConnectionHandle​(java.lang.Object connectionHandle)
      Set the connection handle.
      private void writeObject​(java.io.ObjectOutputStream oos)
      Write object
      • Methods inherited from class java.util.EventObject

        getSource, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Serial version uid
      • serialPersistentFields

        private static final java.io.ObjectStreamField[] serialPersistentFields
        Persistence field information
      • CONNECTION_CLOSED

        public static final int CONNECTION_CLOSED
        Event notification that an application component has closed the connection
        See Also:
        Constant Field Values
      • LOCAL_TRANSACTION_STARTED

        public static final int LOCAL_TRANSACTION_STARTED
        Event notification that a Resource Manager Local Transaction was started on the connection
        See Also:
        Constant Field Values
      • LOCAL_TRANSACTION_COMMITTED

        public static final int LOCAL_TRANSACTION_COMMITTED
        Event notification that a Resource Manager Local Transaction was committed on the connection
        See Also:
        Constant Field Values
      • LOCAL_TRANSACTION_ROLLEDBACK

        public static final int LOCAL_TRANSACTION_ROLLEDBACK
        Event notification that a Resource Manager Local Transaction was rolled back on the connection
        See Also:
        Constant Field Values
      • CONNECTION_ERROR_OCCURRED

        public static final int CONNECTION_ERROR_OCCURRED
        Event notification that an error occurred on the connection. This event indicates that the ManagedConnection instance is now invalid and unusable.
        See Also:
        Constant Field Values
      • e

        private java.lang.Exception e
        Exception associated with the ConnectionEvent instance.
      • id

        protected int id
        Type of the event
      • connectionHandle

        private java.lang.Object connectionHandle
    • Constructor Detail

      • ConnectionEvent

        public ConnectionEvent​(ManagedConnection source,
                               int eid)
        Construct a ConnectionEvent object. Exception defaults to null.
        Parameters:
        source - ManagedConnection that is the source of the event
        eid - type of the Connection event
      • ConnectionEvent

        public ConnectionEvent​(ManagedConnection source,
                               int eid,
                               java.lang.Exception exception)
        Construct a ConnectionEvent object.
        Parameters:
        source - ManagedConnection that is the source of the event
        exception - exception about to be thrown to the application
        eid - type of the Connection event
    • Method Detail

      • getConnectionHandle

        public java.lang.Object getConnectionHandle()
        Get the connection handle associated with the Managed Connection instance. Used for CONNECTION_CLOSED event.
        Returns:
        the connection handle. May be null
      • setConnectionHandle

        public void setConnectionHandle​(java.lang.Object connectionHandle)
        Set the connection handle. Used for CONNECTION_CLOSED event
        Parameters:
        connectionHandle - The connection handle
      • getException

        public java.lang.Exception 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 id
      • readObject

        private void readObject​(java.io.ObjectInputStream ois)
                         throws java.lang.ClassNotFoundException,
                                java.io.IOException
        Read object
        Parameters:
        ois - The object input stream
        Throws:
        java.lang.ClassNotFoundException - If a class can not be found
        java.io.IOException - Thrown if an error occurs
      • writeObject

        private void writeObject​(java.io.ObjectOutputStream oos)
                          throws java.io.IOException
        Write object
        Parameters:
        oos - The object output stream
        Throws:
        java.io.IOException - Thrown if an error occurs