Results 1 to 6 of 6

Thread: CommonsPoolTargetSource : configuring pool properties.

  1. #1
    Join Date
    Aug 2004
    Location
    Paris - France
    Posts
    17

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    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
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  3. #3
    Join Date
    Aug 2004
    Location
    Paris - France
    Posts
    17

    Default

    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

  4. #4
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    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
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  5. #5
    Join Date
    Aug 2004
    Location
    Paris - France
    Posts
    17

    Default

    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

  6. #6
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Joel,

    Just committed the fix.

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

Similar Threads

  1. FlowExecutionStorage in a DB
    By cacho in forum Web Flow
    Replies: 7
    Last Post: Oct 19th, 2009, 03:36 PM
  2. Hibernate Properties as JMX
    By FelderR in forum Container
    Replies: 1
    Last Post: Jul 4th, 2005, 04:59 AM
  3. Replies: 0
    Last Post: May 8th, 2005, 02:15 AM
  4. Shared properties within application context
    By milosh in forum Architecture
    Replies: 5
    Last Post: Nov 16th, 2004, 08:29 AM
  5. Replies: 19
    Last Post: Oct 20th, 2004, 11:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •