• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ejb Caching

 
jay roy
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

1. Does it make sense to cache the jndi look up calls to ejb home object when client is trying to access a bean?
2. Does it make sense to cache the reference we would get from using the EJBObject.getHandle(), then use this reference when attempting to access the bean?

If answer to any of the above questions is YES, any idea on how i can accomplish that?


thanks
J
[ December 23, 2006: Message edited by: jay roy ]
 
Deepak Pant
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is Yes and you should check the "Core J2EE Patterns" book for the strategies to implement.
 
Raja Mani
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

1. Does it make sense to cache the jndi look up calls to ejb home object when client is trying to access a bean?

No It does'nt make sence beacuse the purpose of JNDI look up is to achive the location transperancy. Suppose if you cache a jndi look up calls to ejb home object and if the admin change the location of the ejb home object then in that case you will end up in a problem.
 
jay roy
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually it makes sense to cache the jndi look up calls and that is implimented in the service locator design pattern.
 
Raja Mani
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cacheing the jndi look up in the service locator pattern is an optional.

If you go for jndi cacheing ensure that if any location change happens against your home bean interface in the jndi, then it should get reflected in your cache also.
 
jay roy
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there is any location change, then it must get reflected in every scenario, cache and non-cache.
 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vijay Rmk:
.....
Go for enhanced service locator pattern.This will initialise a low priority thread (on interval specified ) and check for availabilty of beans.
....
..


I swear some reading on the Sun site indicated that:
That J2EE components were not supposed to spin off threads.
In general the spinning off of threads by J2EE components shoulc be consiered verboten.


I like the idea of an improved service locator, but are you not opening yet another can of thread safty worms.
 
dinesh pande
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that we have finally diverted to a solution which is generic to any caching solution ( home interfaces or not ).

To start with, caching is always a help (home interfaces or other objects ..)

When exactly the cached objects become stale is dependent on your application requirements.

In my opinion, the final answer to the original poster, yes use caching similar to the one used in ServiceLocator pattern, unless you have exceptional reasons for not doing so.
 
jay roy
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i agree with dinesh,

thank you guys for the responses,
J
 
jay roy
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i agree with dihesh,

thank you guys for the responses,
J
 
S Santhosh
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This was an interesting article i had read sometime back....

JNDI Caching

Please see this is in reference to J2EE 1.3... you may wanna check how applicable this is to JEE 5.0.

Thanks,
San
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic