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

Usage of System.currentTimeMillis() as key for a TreeMap

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.3
    • Fix Version/s: 1.4
    • Labels:
      None

      Description

      In the method 'clearOldest' of GenericKeyedObjectPool the class ObjectTimestampPair is used as keys for a TreeMap wich compares the elements by System.currentTimeMillis().

      If two ObjectTimestampPair instances have the same timestamp the value in the map will be overridden and the wrong instance will be destroyed.

      If you use the pool with hibernate it will be result in a Statement already close Exception.

      As a patch i return never zero in the compareTo method of ObjectTimestampPair.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                hbmann Hauke Rabe
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: