• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create a cache for JNDI calls

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thank you for reading my post.
can some one give me some helps tp create a cache for JNDI lookups.

I have tens of web services in a web application (war) and they all use JNDI lookups widely.

Now i want to create a cache to prevent extra jndi lookups. As they stateless web services then i can not create a chache inside one of them because after each call the cache will be gone.

what i thought is creating a servlet that initiate a cache when application start, but i do not know how i can do it. (in term of writing codes and design pattern)

Can you give me some tips?

Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raminaa,
Why not just use a singleton class as your cache?
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which application server are you using?

Some actually do this behind the scenes for you.

Have you positively identified this as a bottleneck in your application? If the lookup time is incomparable to the time it takes to interact and use the resource/web service, then optimizing this step is merely an academic exercise, of little value to actual runtime performance.

Just a thought.

-Cameron McKenzie
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about a ServiceLocator
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!