Interface ConnectionResource

  • All Known Implementing Classes:
    ConnectionFactoryResource

    public interface ConnectionResource

    The ConnectionResource is the contract used to provide Connection pools to the SJMS component. A user should use this to provide access to an alternative pooled connection resource such as a Connection pool that is managed by a J2EE container.

    It is recommended though that for standard ConnectionFactory providers you use the {@link ConnectionFactoryResource) implementation that is provided with SJMS as it is optimized for this component.

    • Method Detail

      • borrowConnection

        javax.jms.Connection borrowConnection()
                                       throws Exception
        Borrows a Connection from the connection pool. An exception should be thrown if no resource is available.
        Returns:
        Connection
        Throws:
        Exception - when no resource is available
      • returnConnection

        void returnConnection​(javax.jms.Connection connection)
                       throws Exception
        Returns the Connection to the connection pool.
        Parameters:
        connection - the borrowed Connection
        Throws:
        Exception