Announcement Announcement Module
Collapse
No announcement yet.
CommonsPoolTargetSource : configuring pool properties. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • CommonsPoolTargetSource : configuring pool properties.

    Spring version : 1.2.2

    Hi all,

    I'm using AOP in Spring to create a pool of object (in my case Corba connection) with CommonsPoolTargetSource.

    I have set the max size of the pool to 25, I would also like to initialize some of the connection - 10 for example - so that my application perfoms better since 10 connections are ready to use.

    Unfortunately I haven't found any property to set in CommonsPoolTargetSource to initialize a number of object of the pool.
    But in GenericObjectPool (a class from Jakarta Commons Pool) on which CommonsPoolTargetSource relyies on, you can set minIdle property which define the number of object in pool instanciated and ready for use - That's exactly what I want to do !

    So my questions are :

    1 - Is there a direct solution to set minIdle property or something equivalent ?

    2 - Is there a reason not to have exposed minIdle property (and all the other properties of GenericObjectPool) ?

    I'm thinking of subclassing CommonsPoolTargetSource and expose minIdle property but IMHO exposing directly minIdle properties in CommonsPoolTargetSource should have been the preferred solution.

    I may have missed something that's why I'm asking for your lights.
    Many thanks.

    Joel

  • #2
    Joel,

    This is an excellent point. I can't see any particular reason why the minIdle property cannot be set, along with a bunch of other properties such as maxIdle, testOnBorrow etc.

    I'll modify CommonsPoolTargetSource now - the mods should make it into the 1.2.3 release.

    Rob

    Comment


    • #3
      Since I can't wait for 1.2.3 version, I'm gonna make my own version of CommonsPoolTargetSource all commons properties settable.

      If you want I can send you the code.

      Regards,

      Joel

      Comment


      • #4
        Joel,

        if you look in CVS, I committed this code around 3 hours ago. It might take a short while to update to public CVS but it is there.

        Regards,

        Rob

        Comment


        • #5
          Thanks !

          just check CVS and found a little mistake :

          Code:
          protected ObjectPool createObjectPool() {
          		GenericObjectPool gop = new GenericObjectPool(this);
          		gop.setMaxActive(getMaxSize());
          		gop.setMaxIdle(getMaxIdle());
          	-->   gop.setMinIdle&#40;getMaxIdle&#40;&#41;&#41;;  <--
          		gop.setMaxWait&#40;getMaxWait&#40;&#41;&#41;;
          &#125;
          Regards,

          Joel

          Comment


          • #6
            Joel,

            Just committed the fix.

            Rob

            Comment

            Working...
            X