Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OnShutdown event in a Windows Service
Message
From
29/03/2014 20:40:01
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01597504
Message ID:
01597669
Views:
27
I have found what looked like a perfect way to get a hold on this:
    Protected Overrides Sub OnShutdown()

        ' If the robot is busy
        If oRobot.lBusy Then
            oRobot.lShutDown = True
            RequestAdditionalTime(30000)
        Else

            ' If we cannot stop the robot
            If Not oRobot.StopRobot() Then

            End If

        End If

    End Sub
Basically, I added a global property in the class lBusy. When the robot loop is in progress, this is True. If this is True, additional requested time will be applied.

So far so good, I can see it goes in there, it sees it is busy, it requests additional time, it goes back in here a second time, and this will go until the robot is no longer busy.

The problem here is I am loosing resources. The robot needs to have access to drives and things like that. As the shutdown event is proceeding with whatever it can, it starts by stopping other services, my robot is still running, but then it cannot write a file, communicate with SQL Server and so on.

So, this thinking was good but it would only work if I can put a hold on all other shutdown operations until this one is clean. And, I do not see how that could be possible. So, as resources are needed, I guess we will have to remain with those procedures. Someone has to initiate a stop of all the robots from the Web interface. That will stop them all. As no shutdown is effective, all resources needed as still available. So, if a robot is not busy, it closes, otherwise, it will close after its process. Then, someone can initiate the shutdown request.

Unless you see a way to apply a lock right at the top of the shutdown chain, I really do not see how this could be possible.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform