|
From: Leif M. <le...@ta...> - 2005-10-13 02:42:20
|
Russell,
I often write applications that contain cron-job like functions. I
even have a timer
manager component which simplifies the task as it is so common. Nothing
wrong
with it. ;-)
For your application, I would just have a single thread which has a
main loop
that calls a method running your FeedMonitor then sleeps for 15
minutes. If would
loop until the JVM decides its time to shut down.
You would want to implement a shutdown hook that would be able to
wake the
main loop up so it could exit in the middle of the 15 minute wake as
well. That
will be needed to make the app shutdown promptly.
Cheers,
Leif
Russell Brown wrote:
>Sorry, I reposted the message because I actually sent it before I approved my subscription and I got an error email.
>
>The application I made some more changes last night and it now works as follows. I have a Service.class which is called by the
>wrapper. That starts a MonitorService thread, which then runs the actual FeedMonitor every 15 minutes. So is it stupid to have a
>thread running a thread that starts a new thread every 15 minutes, just to avoid a bunch of base db hits and processing every 15
>minutes... I'm starting to think so, but it was at least a good practice in futility.
>
>Is what I have no correct or a bastardization of Java and the Wrapper in general?
>
>Thanks
>Russ
>
>
|