Discussions

EJB design: Ejb Reference Cache: the Remote Interface too?

  1. Ejb Reference Cache: the Remote Interface too? (2 messages)

    Everybody says to cache EJBHome references, to avoid JNDI lookup overhead. But what about the Remote Interface?
    Why not to Cache it too? Someone can give me an explaination?
    Deeply: is there any difference with the different kinds of EJBs? (I'm using just one Stateless...)
    Thank's and bye
    Ivan
  2. You should not cache the EJBObject. Because, It's just a reference and it's not necessarily guaranteed to remain "connected" to the EJB container or may have collected by GC.
    On other side, EJBHome, which is already bound with JNDI and can't be invalidate and therefore are best candidate for cache.
    I don't know but it's depend on your application design and requirement but Handles are more better then EJBHome in terms of caching.

    Hope this will help :)
  3. link to an interesting thread[ Go to top ]

    Hello Amit,
    I Thank you for your answer. In the time I had found a very interesting thread here
    http://www.jguru.com/faq/view.jsp?EID=734699
    Take a look if you want.

    With that information I cached the EJBHome too (in particular the EJB Handle). I hope it will work fine...