some preamble: have windows service has timer firing every ten seconds (although configurable in app.config). when timer fires event, event handler creates instance of object (let's call executor) work. executor object creates background threads execute queue of tasks obtained db. of time, executor's threads have finished within 60 seconds, there reasonable chance @ 1 time, there 6 or more instances of executor object, doing work (it's lightweight work, can long running gets , fetches , waits on stuff - after period of time, gives if still not complete).
if service asked stop, don't want leave these background threads behind, , under circumstances, might want let executor objects finish before shutting down.
is possible, in onstop() method, collection of instances of executor object, , check property on each one, make decision there?
my current thinking each time instantiate executor, add collection (and remove each instance when it's done), consult collection when i'm stopping. seems clean-ish, i'm wondering if there more 'fluid' way?
i understand not bother, , go requestadditionaltime cover think maximum time let finish up, wouldn't assume there won't ever slowness issues or bigger tasks in future.
the collection way go. add them , on end of service go through each , have them kill respective tasks.
Comments
Post a Comment