• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Ejb Caching

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer is Yes and you should check the "Core J2EE Patterns" book for the strategies to implement.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If there is any location change, then it must get reflected in every scenario, cache and non-cache.
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i agree with dihesh,

thank you guys for the responses,
J
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Fire me boy! Cool, soothing, shameless self promotion:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic