Package org.firebirdsql.jaybird.xca

## Class FBStandAloneConnectionManager

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

- All Implemented Interfaces:
    `java.io.Serializable`, `XcaConnectionEventListener`, `XcaConnectionManager`

      public final class FBStandAloneConnectionManager
      extends java.lang.Object
      implements XcaConnectionManager, XcaConnectionEventListener, java.io.Serializable

  The class `FBStandAloneConnectionManager` provides the default implementation of FirebirdConnectionManager for standalone use. There is no pooling or other features.
  Author:
    David Jencks, Mark Rotteveel
  See Also:
    Serialized Form

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `FirebirdConnection` | `allocateConnection​(FBManagedConnectionFactory mcf, FBConnectionRequestInfo cxRequestInfo)` | Allocates a new `FirebirdConnection` backed by a `FBManagedConnection` from the specified factory.
    `void` | `connectionClosed​(XcaConnectionEvent ce)` | Notifies the close of a connection.
    `void` | `connectionErrorOccurred​(XcaConnectionEvent ce)` | Notifies a connection related error.

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

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

- - ### Method Detail

    - #### allocateConnection

          public FirebirdConnection allocateConnection​(FBManagedConnectionFactory mcf,
                                                       FBConnectionRequestInfo cxRequestInfo)
                                                throws java.sql.SQLException

      Description copied from interface: `XcaConnectionManager`
      Allocates a new `FirebirdConnection` backed by a `FBManagedConnection` from the specified factory.

      The returned connection should behave as a new connection, but may be backed by an already established (eg pooled) managed connection.

      Specified by:
        `allocateConnection` in interface `XcaConnectionManager`
      Parameters:
        `mcf` - Managed connection factory
        `cxRequestInfo` - Specific connection request info
      Returns:
        A new `FirebirdConnection` instance
      Throws:
        `java.sql.SQLException` - for generic exceptions

    - #### connectionClosed

          public void connectionClosed​(XcaConnectionEvent ce)

      Description copied from interface: `XcaConnectionEventListener`
      Notifies the close of a connection.

      A managed connection notifies its listeners by calling this method when an application component closes a connection handle. The owner of the managed connection can use this event to put the managed connection instance back in to the connection pool, or close the physical connection.

      Specified by:
        `connectionClosed` in interface `XcaConnectionEventListener`
      Parameters:
        `ce` - Connection event

    - #### connectionErrorOccurred

          public void connectionErrorOccurred​(XcaConnectionEvent ce)

      Description copied from interface: `XcaConnectionEventListener`
      Notifies a connection related error.

      The managed connection instance calls this method to notify its listeners of the occurrence of a physical connection-related error. The event notification happens just before it throws an exception to the application component using the connection handle.

      This method indicates that the associated managed connection instance is now invalid and unusable. The owner of the managed connection handles the connection error event notification by initiating owner-specific cleanup (for example, removing the managed connection instance from the connection pool) and then calling the destroy method to destroy the physical connection.

      Specified by:
        `connectionErrorOccurred` in interface `XcaConnectionEventListener`
      Parameters:
        `ce` - Connection event