Re: Refresh
Re: Refresh
- Subject: Re: Refresh
- From: Florijan Stamenkovic <email@hidden>
- Date: Tue, 27 Feb 2007 16:02:35 +0100
Hi all,
What I always had trouble with when attempting to use timers is the
problem it creates when running multiple instances of your
application.
I don't see why that would be a problem, if a Timer is static.
Initialize it once, and never worry about it again.
If you use a timer inside your WO application instance, and you
have more than one instance of your application running, then you
will have more than one timer running possibly updating your file
more often than you really want.
It may be possible to configure your timer to run on only one
instance, say instance number 1. The problem here is that if
instance 1 is shutdown then no timer will be running even if their
are other instances available.
Static comes in handy here. Instances shut down, timer keeps running.
Just make sure that you make a timer whose execution thread is a
daemon. Otherwise it keeps running and running and running....
Using an outside scheduler solves these issues in a clean and
effective way.
Yeah, kind of nice.
As an extension to this method I often run the process in a
separate thread, for those actions that may take more than a few
seconds to execute.
I would probably stick to a static Thread in the Application class
anyway, that is started with the first instance. Nice and simple.
Timer in my eyes only becomes handy if you need to schedule a lot of
different tasks at different intervals.
My two cents,
Flor
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Refresh (From: WIESEN Bruno <email@hidden>) |
| >Re: Refresh (From: Zak Burke <email@hidden>) |
| >Re: Refresh (From: Robert Walker <email@hidden>) |