B
Blue Streak
Hi, Folks!
I have a question about concurrent timers. In my current project
I am writing an NT Service (I know that is old terminology but I work
with idiots who think you mean Web Service when you say Service) that
scans an database table. I have one timer setup to scan about every
15 seconds for new records, does its number crunching for that record,
then marks it as processed with Now() in a DateTime field.
The first timer / process is working fine. However, I wanted to
add some maintenance into the NT Service such that the database table
doesn't grow too large. My idea was to run a second timer set to scan
the table every 12 or 24 hours and check the age of the record based
on the Processed field. When the record is of a certain age (e.g. 5
days) then it is deleted or archived depending on what my boss wants.
I have been trying to think of a scheme that prevents both jobs
from running concurrently. If one process is running how do you get
the other process to wait until the other is finished?
I don't think adding the line Timer.Enable = false would cut it
because it would reset the timer back to zero. Using that on the
first timer is fine because it runs every 15 seconds. However, using
that technique on the second timer would be a problem because it would
end up never running.
Any ideas?
TIA...
I have a question about concurrent timers. In my current project
I am writing an NT Service (I know that is old terminology but I work
with idiots who think you mean Web Service when you say Service) that
scans an database table. I have one timer setup to scan about every
15 seconds for new records, does its number crunching for that record,
then marks it as processed with Now() in a DateTime field.
The first timer / process is working fine. However, I wanted to
add some maintenance into the NT Service such that the database table
doesn't grow too large. My idea was to run a second timer set to scan
the table every 12 or 24 hours and check the age of the record based
on the Processed field. When the record is of a certain age (e.g. 5
days) then it is deleted or archived depending on what my boss wants.
I have been trying to think of a scheme that prevents both jobs
from running concurrently. If one process is running how do you get
the other process to wait until the other is finished?
I don't think adding the line Timer.Enable = false would cut it
because it would reset the timer back to zero. Using that on the
first timer is fine because it runs every 15 seconds. However, using
that technique on the second timer would be a problem because it would
end up never running.
Any ideas?
TIA...