H
hazz
What happens if I set the timer interval for a period that is less than the
time it will take to process the loop below? Right now my application is
returning just a few items in an arraylist to process but the process should
scale to 100 or even 1000 loops. If the functions contained within the loop,
some of which go out to web services, take an indeterminate amount of time,
how do I design my windows service so that if the code takes longer than the
interval, no funny things will happen? Thank you. -hazz
Public Class Service1
Inherits System.ServiceProcess.ServiceBase
Protected Overrides Sub OnStart(ByVal args() As String)
Timer1.Interval =
System.Configuration.ConfigurationSettings.AppSettings("Interval")
Timer1.Enabled = True
End Sub
Private Sub Timer1_Elapsed(ByVal sender As System.Object,
ByVal e As System.Timers.ElapsedEventArgs)
Handles Timer1.Elapsed
dim obj as New ControllerClass
For i = 1 to 100
obj.hydrate_business_objects()
obj.Do_100_millisecond_Function()
obj.Do_2_to_5_second_Function()
obj.PerformBusinessRules()
obj.UpdateDatabase()
Next
End Sub
End Class
time it will take to process the loop below? Right now my application is
returning just a few items in an arraylist to process but the process should
scale to 100 or even 1000 loops. If the functions contained within the loop,
some of which go out to web services, take an indeterminate amount of time,
how do I design my windows service so that if the code takes longer than the
interval, no funny things will happen? Thank you. -hazz
Public Class Service1
Inherits System.ServiceProcess.ServiceBase
Protected Overrides Sub OnStart(ByVal args() As String)
Timer1.Interval =
System.Configuration.ConfigurationSettings.AppSettings("Interval")
Timer1.Enabled = True
End Sub
Private Sub Timer1_Elapsed(ByVal sender As System.Object,
ByVal e As System.Timers.ElapsedEventArgs)
Handles Timer1.Elapsed
dim obj as New ControllerClass
For i = 1 to 100
obj.hydrate_business_objects()
obj.Do_100_millisecond_Function()
obj.Do_2_to_5_second_Function()
obj.PerformBusinessRules()
obj.UpdateDatabase()
Next
End Sub
End Class