> Hi. > > I was wondering if any other Struts developers have a situation > similar to ours regarding the resetting "Application" scoped data once a > day? If so, I'd like to know what solution you used. > > Here's our particular situation: > > We have choices on an input screen, a drop-down menu to be exact, > that come from a database. The choices only change once a day -- in the > middle of the night after a batch job runs on another machine. Since > these choices are always the same, we don't want to take a database hit > every time a user comes to our particular page. Therefore, we've elected > to store the choices in hashmap scoped at the Application level. > However, once a day we would like to update the hashmap. Ideally, at > a particular time after we know the batch job on the other machine has. > For example, 4:00 a.m. We would like this time to be configurable via > the web.xml file. We've extended both the Struts "ActionServlet" and > "Action" classes to do some additional processing that we need. Hence, > all our action classes derive from our extended Struts "Action" class. We > use our extended Struts "ActionServlet" class as our main servlet. > > My question is this: > > If we write some logic to monitor for the first request that occurs > after each day rollover time (e.g. 4:00 a.m.), should this logic reside in > the Servlet or our base Action class? Either way, this day rollover check > would have to occur every time a HTTP request is made. Is this a > reasonable solution? Or would a better solution be to spawn a separate > thread that simply sleeps until the configured time each day (e.g 4:00 > a.m.) and then wakes up to update the Application scoped hashmap? > Has anyone addressed this need before? > > Thanks, > > John >
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>