org.firebirdsql.jaybird.xca

## Class XcaConnectionEvent

- java.lang.Object
- - org.firebirdsql.jaybird.xca.XcaConnectionEvent

-     public final class XcaConnectionEvent
      extends java.lang.Object

  The `XcaConnectionEvent` class provides information about the source of a connection related event. A `XcaConnectionEvent` instance contains the following information:
  - Type of the connection event
  - `FBManagedConnection` instance that generated the connection event. A `FBManagedConnection` instance is returned from the method `getSource()`
  - Connection handle associated with the `FBManagedConnection` 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`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `XcaConnectionEvent.EventType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XcaConnectionEvent(FBManagedConnection source, XcaConnectionEvent.EventType eventType)` Construct a `ConnectionEvent` object.
    `XcaConnectionEvent(FBManagedConnection source, XcaConnectionEvent.EventType eventType, java.lang.Exception exception)` Construct a `ConnectionEvent` object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `FirebirdConnection` | `getConnectionHandle()` Get the connection handle associated with the managed connection instance.
    `XcaConnectionEvent.EventType` | `getEventType()`
    `java.lang.Exception` | `getException()` Get the exception associated with this event.
    `FBManagedConnection` | `getSource()`
    `void` | `setConnectionHandle(FirebirdConnection connectionHandle)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XcaConnectionEvent

          public XcaConnectionEvent(FBManagedConnection source,
                                    XcaConnectionEvent.EventType eventType)

      Construct a `ConnectionEvent` object.
      Parameters:
        `source` - the source of the event
        `eventType` - Type of event

    - #### XcaConnectionEvent

          public XcaConnectionEvent(FBManagedConnection source,
                                    XcaConnectionEvent.EventType eventType,
                                    java.lang.Exception exception)

      Construct a `ConnectionEvent` object.
      Parameters:
        `source` - the source of the event
        `eventType` - Type of event
        `exception` - Exception associated with the event

  - ### Method Detail

    - #### getSource

          public FBManagedConnection getSource()

      Returns:
        The managed connection on which the event initially occurred.

    - #### getConnectionHandle

          public FirebirdConnection getConnectionHandle()

      Get the connection handle associated with the managed connection instance. Used for `CONNECTION_CLOSED` event.
      Returns:
        The connection handle, can be `null`

    - #### setConnectionHandle

          public void setConnectionHandle(FirebirdConnection connectionHandle)

    - #### getException

          public java.lang.Exception getException()

      Get the exception associated with this event.
      Returns:
        Exception for this event, can be `null` for event type other than `CONNECTION_ERROR_OCCURRED`

    - #### getEventType

          public XcaConnectionEvent.EventType getEventType()

      Returns:
        The type of event

Copyright © 2001-2025 Jaybird (Firebird JDBC) team. All rights reserved.