Member_2_6478753
asked on
thread pooling
i have a table. who have always new record on it
so i want to process all record when i process it i change the status of record field to begin processing and when i finish i update the status to done
i have read some topics and they talk about thread and time.. and pooling
the default value of status of task is "to process"
do a task ! like select top (100) from table where status = "to process"
than i update the status to begin process .
insert in other table
update status to done
i want to use transction begin and end and rollback if my job not committed it will be rollback i don\t know about how to it on c# and mssql ..
than sleep to 30 second.. after fetch all top 100 row and do my job slelect update insert
than i repeat it always. i want to run it as windows services.
can any one check tthis code and tell me if it was i try to doo
http://www.codeproject.com/Articles/16615/How-to-Create-a-Simple-Polling-Service
Private Sub PollProcess()
' Loops, until killed by OnStop.
EventLog1.WriteEntry("Poll ingService service polling thread started.")
Do
' Wait...
System.Threading.Thread.Sl eep(30000) ' 30000 = 30 seconds
PollingPass()
Loop
End Sub
Private Sub PollingPass()
Try
' Do Stuff Here...
EventLog1.WriteEntry("Poll ingService service polling pass executed.")
Catch ex As System.Exception
EventLog1.WriteEntry("Poll ingService encountered an error '" & _
ex.Message & "'", EventLogEntryType.Error)
EventLog1.WriteEntry("Poll ingService service Stack Trace: " & _
ex.StackTrace, EventLogEntryType.Error)
End Try
End Sub
' Do Stuff Here...
here i wil but my sql query????
and i want some one tell me if this app do a a stuff when the stuff finish ... sleep 30 second and repeat the same jobbbbbbbbbbb???????????/
i need to do like this ?
so i want to process all record when i process it i change the status of record field to begin processing and when i finish i update the status to done
i have read some topics and they talk about thread and time.. and pooling
the default value of status of task is "to process"
do a task ! like select top (100) from table where status = "to process"
than i update the status to begin process .
insert in other table
update status to done
i want to use transction begin and end and rollback if my job not committed it will be rollback i don\t know about how to it on c# and mssql ..
than sleep to 30 second.. after fetch all top 100 row and do my job slelect update insert
than i repeat it always. i want to run it as windows services.
can any one check tthis code and tell me if it was i try to doo
http://www.codeproject.com/Articles/16615/How-to-Create-a-Simple-Polling-Service
Private Sub PollProcess()
' Loops, until killed by OnStop.
EventLog1.WriteEntry("Poll
Do
' Wait...
System.Threading.Thread.Sl
PollingPass()
Loop
End Sub
Private Sub PollingPass()
Try
' Do Stuff Here...
EventLog1.WriteEntry("Poll
Catch ex As System.Exception
EventLog1.WriteEntry("Poll
ex.Message & "'", EventLogEntryType.Error)
EventLog1.WriteEntry("Poll
ex.StackTrace, EventLogEntryType.Error)
End Try
End Sub
' Do Stuff Here...
here i wil but my sql query????
and i want some one tell me if this app do a a stuff when the stuff finish ... sleep 30 second and repeat the same jobbbbbbbbbbb???????????/
i need to do like this ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
When the timer method is called , first you disable your timer so it doesn't trigger again.
Do you select, insert etc
Finally you enable th timer, so that it waits for 30 seconds and triggers.