Results 1 to 3 of 3

Thread: Use single LDAP connexion

  1. #1
    Join Date
    Apr 2007
    Posts
    2

    Default Use single LDAP connexion

    Hi,
    following my goal:
    - My application should connect to an LDAP (using ldaptemplate), retreive data and then close connection. The retrieved data will reside in an ehcache instance.
    Every Hour, the cache expire and my application will reconnect to the LDAP to retrieve the fresh datas.

    I'm using the following configuration to feat to my need, I'm using a pool with 1 connection that expire after 10s of inactivity.
    -Dcom.sun.jndi.ldap.connect.timeout=10000
    -Dcom.sun.jndi.ldap.connect.pool=true
    -Dcom.sun.jndi.ldap.connect.pool.maxsize=1


    I thought that my config will ensure that the maximum number of connections will be 1. this was not the case.

    Could you please tell me what's wrong with my approach and if there is another one to feet my objective ?

  2. #2
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    For the details on pooling I'd have to refer you to the Java LDAP documentation. Spring LDAP does not touch the pooling issues at all, other than turning it on or off.

    However, looking at your situation I don't see any use for pooling at all. I think you should turn off pooling completely, by setting the 'pooled' flag of your ContextSource to false.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  3. #3
    Join Date
    Apr 2007
    Posts
    2

    Default RE : Single LDAP connection

    Thank you rasky for your prompt reply

    Quote Originally Posted by rasky View Post
    For the details on pooling I'd have to refer you to the Java LDAP documentation. Spring LDAP does not touch the pooling issues at all, other than turning it on or off.
    > I agree with you (I sow your other posts on pooling issues)

    Quote Originally Posted by rasky View Post
    However, looking at your situation I don't see any use for pooling at all. I think you should turn off pooling completely, by setting the 'pooled' flag of your ContextSource to false.
    I want to make dozens of requests using the same connection and then close asap the connection (this scenario will be reproduced each 1 hour, when the data cache expire).
    since the ldaptemplate call DirContext.close() for each request, I want to ensure that it will not close the connection but turn it back to the pool.

    I guess that turning off pooling will create a new connection for each operation.

    could you please advice me how can I "properly" implement my use case using Spring Ldap ?

    best regards,
    Anis zouaoui

Posting Permissions

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