Application is still running or a crash occured
-
Hello, Application ----------- I've created a multi-tier application. Its architecture is: On client machine --> the client application is an ActiveX EXE component (VBasic). On server machine --> some COM+ server applications and a SQLServer database. Use Case -------- CLIENT1 --> asks SQLServer database for an object (= a row in objects table). The state of this object is stored in a storage file. --> if the object can be check out, it means nobody else have checked out the object, the server will set the objects.checkedoutby = ClientID and will copy the stg file in a shared folder on server machine. CLIENT2 --> tries to check out the same object --> the server must know (??? - MY QUESTION IS ABOUT THIS POINT) if the CLIENT1 application is still running or a crash has occured and CLIENT1 was not able to check in the object. Remarks ------- 1) CLIENT2 will receive a copy of the storage file if CLIENT1 is still running 2) CLIENT2 will have the possibility to restore the storage file from an older version if a crash occured in the CLIENT1 application. 3) Many clients can log in using the same account (user name and password) 4) There can be more than one instances of the application on the same client machine My solution ----------- My solution is to create an instance of an "watchdog" ActiveX EXE on the client machine when the client application is started. This "watchdog", from time to time (5 minutes by example), will modify the value of a date field named NotificationDate in database. When the client application shuts down, the "watchdog" will stop updating that field. The stored procedure responsible for check out will use the value of NotificationDate field to decide whether the CLIENT1 application that use this object is still running or a crash has occured. Questions --------- 1) Is there a pattern for this problem? 2) What about my solution? 10x, Ovidiu