It's not a secret anymore!
The moose likes Servlets and the fly likes Caching Data After StartUp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Caching Data After StartUp" Watch "Caching Data After StartUp" New topic

Caching Data After StartUp

Andrew DevSterMan

Joined: Nov 26, 2003
Posts: 6
I've got a servlet to cache my data from several databases located all over the world. Some have fast lines, some slow. I initially had all of the data cached on start-up by setting the servlet to run in web.xml, but now some of the offices that have been added are taking 10 minutes plus to connect to.
My question is, how do I automate the caching of my data after the appilcation itself has started, so that the application doesn't take forvever to come online, but that the data can be populated as the databases return their queries?
I'd really appreciate any example code.
Many thanks

A carrot is as close as a rabbit gets to a diamond.
shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
i guess, you can start a background thread in your init() method of the servlet. this will not stop your appl. from coming online.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
1. Didn't you already post this question and get reasonable answers in some other forum? I seem to recall exactly this question.
2. Your name is not compatible with JavaRanch conventions - didn't you read the instructions when you signed up?
I agree. Here's the link:
subject: Caching Data After StartUp
It's not a secret anymore!