Class ConnectionCloseHolder


  • public class ConnectionCloseHolder
    extends Object
    Holder for a connection that makes sure the close action is invoked atomically only once.
    Version:
    1.0.0
    Author:
    Gang Cheng
    • Constructor Detail

      • ConnectionCloseHolder

        public ConnectionCloseHolder​(io.r2dbc.spi.Connection connection,
                                     Function<io.r2dbc.spi.Connection,​org.reactivestreams.Publisher<Void>> closeFunction)
        Instantiates a new Connection close holder.
        Parameters:
        connection - the connection
        closeFunction - the close function
    • Method Detail

      • getTarget

        public io.r2dbc.spi.Connection getTarget()
        get target
        Returns:
        connection
      • close

        public reactor.core.publisher.Mono<Void> close()
        close
        Returns:
        mono
      • isClosed

        public boolean isClosed()
        Is closed boolean.
        Returns:
        the boolean