Uploaded image for project: 'Commons Pool'
  1. Commons Pool
  2. POOL-40

[pool] GenericKeyedObjectPool is a LIFO, not a FIFO implementation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.3
    • None
    • Operating System: All
      Platform: All

    • 36904

    Description

      Like GenericObjetPool is a LIFO as described in COM-1866 ,
      GenericKeyedObjectPool has the same discrepancy between documentation and
      implementation. Soon to be attached is a patch which brings the implementation
      of GenericKeyedObjectPool into line with the documentation and provides a unit
      test to verify this.

      This patch has the side effect of breaking the
      TestKeyedObjectPool.testBaseBorrowReturn() test which is broken for a FIFO. If
      you look at lines 90 to 94, copied below, you'll see that it clearly tests a
      LIFO behavior.

      _pool.returnObject(keya,obj0);
      _pool.returnObject(keya,obj2);
      obj2 = _pool.borrowObject(keya);
      obj0 = _pool.borrowObject(keya);

      It's my opinion that those last lines of
      TestKeyedObjectPool.testBaseBorrowReturn() should be removed as they are shared
      between the GenericKeyedObjectPool and the StackKeyedObjectPool and if one is to
      be a FIFO and the other a LIFO those lines of cannot be correct for both at the
      same time.

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--GenericKeyedObjectPool-FIFO.patch
          2 kB
          Sandy McArthur (from Bugzilla import)

        Activity

          People

            Unassigned Unassigned
            sandymac@apache.org Sandy McArthur (from Bugzilla import)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: