Interface PoolingConnectionProvider<C>

Type Parameters:
C - the generic type of the connections to be handled
All Superinterfaces:
ConnectionProvider<C>

@MinMuleVersion("4.5") public interface PoolingConnectionProvider<C> extends ConnectionProvider<C>
A ConnectionProvider specialization which pools connections.

This interface is declarative. The actual pooling is not implemented on the provider itself but performed by the runtime.

This interface also provides onBorrow(Object) and onReturn(Object) allowing to perform operations when a connection is borrow and/or returned to the pool.

Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onBorrow(C connection)
    Executes after the connection was successfully borrowed from the pool but before it's handed over to the requester.
    default void
    onReturn(C connection)
    Executes right before the pool accepts the connection back.

    Methods inherited from interface org.mule.sdk.api.connectivity.ConnectionProvider

    connect, disconnect, validate
  • Method Details

    • onBorrow

      default void onBorrow(C connection)
      Executes after the connection was successfully borrowed from the pool but before it's handed over to the requester.

      This method can alter the state of the connection as long as it remains on a usable state.

      Parameters:
      connection - the pooled connection
    • onReturn

      default void onReturn(C connection)
      Executes right before the pool accepts the connection back.

      If this method throws exception, then the pool will invalidate the connection. On the other hand, a successful execution of this method does not imply that the pool will successful accept the connection back. The pool is still free to invalidate the connection anyway.

      This method can alter the state of the connection as long as it remains on a usable state.

      Parameters:
      connection - the pooled connection