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

Better config without duplication.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.0
    • None

    Description

      There is code duplication in configuration code.

      I'd like to track an experiment here.

      > ----Original Message----
      > From: Gary Gregory GGregory@seagullsoftware.com
      > Sent: Wednesday, October 20, 2010 10:44
      > To: Commons Developers List
      > Subject: RE: [pool] Reusing Config
      >
      > In the same department, I see the following ivars:
      >
      > lifo : boolean
      > maxActive : int
      > maxIdle : int
      > maxTotal : int
      > maxWait : long
      > minEvictableIdleTimeMillis : long
      > minIdle : int
      > numTestsPerEvictionRun : int
      > testOnBorrow : boolean
      > testOnReturn : boolean
      > testWhileIdle : boolean
      > timeBetweenEvictionRunsMillis : long
      > whenExhaustedAction : WhenExhaustedAction
      >
      > defined in four classes:
      >
      > GenericKeyedObjectPool
      > GenericKeyedObjectPoolFactory
      > GenericObjectPool
      > GenericObjectPoolFactory
      >
      > Which feels to me like a missed opportunity to avoid duplication.
      >
      > Is making one ivar private or final or volatile be applied to all four
      > classes?
      >
      > We could:
      >
      > Use a config object instead of the 13 ivars.
      > Or a common superclass then we can consider if it should hold the ivar list or
      > a Config object.
      >
      > Would it be too weird to have a common super class for BaseObjectPool and
      > BasePoolableObjectFactory for example?
      >
      > Gary Gregory
      > Senior Software Engineer
      > Rocket Software
      > 3340 Peachtree Road, Suite 820 . Atlanta, GA 30326 . USA
      > Tel: +1.404.760.1560
      > Email: ggregory@seagullsoftware.com
      > Web: seagull.rocketsoftware.com
      >
      >
      >
      > > ----Original Message----
      > > From: Gary Gregory GGregory@seagullsoftware.com
      > > Sent: Wednesday, October 20, 2010 10:29
      > > To: Commons Developers List
      > > Subject: [pool] Reusing Config
      > >
      > > Hi All:
      > >
      > > I think this came up recently. Any thoughts or plans on extracting the
      > Config
      > > class out of GenericKeyedObjectPool and GenericObjectPool so it can be
      > reused.
      > > The constants for default values could then also be moved to Config.
      > > Gary Gregory
      > > Senior Software Engineer
      > > Rocket Software
      > > 3340 Peachtree Road, Suite 820 * Atlanta, GA 30326 * USA
      > > Tel: +1.404.760.1560
      > > Email: ggregory@seagullsoftware.com<ggregory@seagullsoftware.com>
      > > Web: seagull.rocketsoftware.com<http://www.seagull.rocketsoftware.com/>
      > >
      >

      Attachments

        1. pool2config.diff
          330 kB
          ggregory@seagullsw.com
        2. pool173-better_config_without_duplication.diff
          250 kB
          Simone Tripodi
        3. genericObjectPoolConfig.patch
          22 kB
          Phil Steitz
        4. commons-pool2-configExisting.png
          227 kB
          Steve Siebert
        5. commons-pool2-configExisting.dia
          6 kB
          Steve Siebert

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ggregory1 Gary Gregory
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: