Consider a large scale application that uses a table in a sql server database to schedule jobs Each row in the table is tagged with a queueID, a methodName and other meta data. The methodName may be a native dot net interface, a legacy com local interface, a 3rd party com interface or URI to a 3rd party web service.
Currently there is a family of 32bit background exe s that process each queueID. There is a set max time limit on how long each job can run set by the queueID, a watchdog will kill the process if the time limit is exceeded.
We want to move this to a 64 bit environment & consolidate the multiple background exe process into a single multi-threaded windows service.
The issue is how do we handle the kill of a job that exceeds the set time limit. If we assign a task for each queueID from a Task Parallel Library from a single appDomain primary thread Clearly net4.0 cancellation tokens cant be used since the thread may run a com interface or a 3rd party web service. If the appDomain watchdog task calls Thread.abort() it may corrupt the entire appDomain & tear down all task threads I am unclear if Thread.Interrupt() would reliably cancel a thread without appDomain corruption.
因此,建议采用什么方法杀死超过时限的read子?
页: 1
Do we just have the service create an AppDomain for each queueID then do myAppDomain1.ExecuteAssembly("queueProcess.exe arg1") myAppDomain2.ExecuteAssembly("queueProcess.exe arg2") ... almost the same arch that exists now but its a win service that controls the appDomains and each queueProcess.exe & then use a the tpl thread pool do run the jobs in a set of smaller pools in each queueProcess.exe & the watch dog just does AppDomain?.Unload when a process has exceeded its time limit