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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.3
    • 1.4
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: