Uploaded image for project: 'Agroal'
  1. Agroal
  2. AG-244

FlushOnClose if requested should be done at all pool sizes and restricts Pool to minSize

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.5
    • None
    • None
    • None
    • False
    • None
    • False

      Hello,
      According to javadoc:

      Allows connections to be flushed upon return to the pool. It's not enabled by default.

      According to code and experience:

      If flushOnClose is configured for a Pool  the Pool does not grow bigger than minSize?

      It  also means, that flushing only occurs if one more than minSize connections are used. 
      The Code can be found in ConnectionPool.java:

        int currentSize = allConnections.size();
        if ( currentSize > configuration.maxSize() 
             || configuration.flushOnClose() 
                && currentSize > configuration.minSize() ) {
            ....
      

            [AG-244] FlushOnClose if requested should be done at all pool sizes and restricts Pool to minSize

            aschoerk well spotted. thanks for reporting !!

            Luis Barreiro added a comment - aschoerk well spotted. thanks for reporting !!

            Answer copied from GitHub PR:

            I wouldn't think so. returnConnectionHandler() is called while return a borrowed connection to the pool. Pool sizing works asynchronous. But there might be conditions when pool is under heavy load that refilling might be not fast enough!

            Benjamin Graf added a comment - Answer copied from GitHub PR: I wouldn't think so. returnConnectionHandler() is called while return a borrowed connection to the pool. Pool sizing works asynchronous. But there might be conditions when pool is under heavy load that refilling might be not fast enough!

            if ( ( currentSize > configuration.maxSize() && currentSize > configuration.minSize() ) || configuration.flushOnClose() )
            

            will garantee that all connections will be flushed but

            currentSize > configuration.minSize() 
            

            is superfluous.
            The result will be that the connection pool will only get the size one in case of flushOnClose().
            Is that intentional?

            Andreas Schörk (Inactive) added a comment - - edited if ( ( currentSize > configuration.maxSize() && currentSize > configuration.minSize() ) || configuration.flushOnClose() ) will garantee that all connections will be flushed but currentSize > configuration.minSize() is superfluous. The result will be that the connection pool will only get the size one in case of flushOnClose(). Is that intentional?

            IHMO it's a bug in the order of the flush conditions. PR#109

            Benjamin Graf added a comment - IHMO it's a bug in the order of the flush conditions. PR#109

              lbarreiro-1 Luis Barreiro
              aschoerk Andreas Schörk (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: