Saving JNDI lookups by caching home references


EJB design: Saving JNDI lookups by caching home references

  1. Saving JNDI lookups by caching home references (24 messages)

    hi. would it be a good idea for an application to save (in memory) home references for reuse (through a singleton prehaps) so that JNDI lookups are done only once per bean?

    for example, i noticed that i a sample app i wrote that the time it too to do a ctx.lookuo was greater than calling home.create. if i have a servlet with a who accesses all its Resources through a singleton, would it not be a good idea to do home lookups once, and just reuse it after that?

    or am i way off base here?

    Threaded Messages (24)

  2. Hi Trevor,

    Seems like an interesting thing to do for developer :)...but news is providers already do that for us. I have known most of the directory services caching the queries/lookups. So yes, you may find ctx.lookup taking some time in the first call, but subsequent lookups on the same object should be faster.

    Hope this helps,
  3. caching home refernces at the client is a great idea.

    but i think its different from cachin in the home reference by app servers at JNDI layer.

    cachin the reference at the client level will save on an extra network call (client n server - different VM/box).
  4. Its certainly a good idea and I use it extensively. I even have general EJBHome cacher. If you are interested let me know. (Ofcourse it comes free, please give ur email)
  5. Hi arjun,

    Even in my project i have written a different class where i am doing all the lookup of the beans so that all the other beans which needs to do lookup do not spend time on doing the same job.

    Well u cld send me yr code..My email id is ..
    rinku_razdan at yahoo dot com

    Thanks in advance
  6. Hi Arjun ,

    Even I am using ejb extensively in my project , I would really appreciate If you can send me your ejb cacher my email id is basant_bineet at yahoo dot com

    Thanxs in advance
  7. EJBHome cacher code[ Go to top ]

    Hi Arjun..
    Can you send me the EJB Home casher code.
    My e-mail: harikrishna dot maharshi at DaimlerChrysler dot com

    - Hari
  8. hi arjun

    could you please send me code you mentioned

  9. Hi arjun,

    That wouldn't be too difficult to implement i think. if homeref != null, lookup....probably a number of ways...perhaps make it a singleton, and there would be one for EJB's themselves to use, and then one in the client env.

    or do you implement it as an ejb itself?

  10. oops, i meant if the lookup key has a null value, then lookup.
  11. Yup pretty simple (who doesn't luv simple things in life:))... yet should be able to support distributed EJBs and I'm still thinking up other stuff which it should be able to do.

    And umm... I think it should be a seperate utility class which can be used by any client not in the EJB itself. Makes a little more generic and save lot of recoding.:))

    Anyways I'm sending out the code to those who requested it.
  12. Oh I forgot.. should support EJBs on any AppServer; failover..etc etc.
  13. Hi ..

     Can u send me ur code ..I am mainly interested in the failover part ...


    Symphoni Interactive
    Technical Lead.
    kvenkataraman at symphoni dot com
    412 414 5385(mobile)
    412 446 2219(Work)
    1 800 439 7757 (# 2219) (Work)
    412 343 6549(Res)
  14. Hi
    We have a high performance objective to reach. ie about 50 messages a second. We are looking to cache a lot of the JNDI data. Similiar to session/Entity facade.

    Firstly please send the code.

    Secondly where do you do the caching and in what do you store this information?

    thanks in advance
  15. Hey Arjun,
    Can you please send me a copy of ur EJBHome chacher?
    We are optimizing code for application performance and need to validate our approach.

    I hope you are still following this thread. :)
    sudha dot gorti at mphasis dot com
  16. Hi Arjun,

    I am in the process of designing something similar.

    Could you also send me your code?

    osarica at up dot com


  17. Hi even I am doing something similar and this will be a great help. My email address is chaturs at hotmail dot com

  18. Sorry for getting back on this so late; but have been on much needed vacation. Failover is onething still semi-done. So will send it out once its done.
  19. Hi,
    I'm also interested in the code. Would you please send a copy to me (anthonyytang at hkex03 dot com dot hk)

  20. Hi Arjun,

    well I'm interested in caching EJBHome reference.
    cud u please mail EJBHome cacher to me at shilpa at musambi dot com

  21. Hi,

    can you send me the source code about caching home referencec, please. My email is

  22. Sorry I know its very old post is it possible to send me the code.


    smithavallaru at yahoo dot com

  23. Arjun from BEC???[ Go to top ]

    Hi Arjun,

    Did you study in BE College Shibpur?
    Sorry, abt using this forum to ask you this but I am desperately trying to reach a friend of mine with the same name.

  24. Yes Birjo[ Go to top ]
  25. here is a reference for any beginers.