INF: Network-Independent Way to Shut Down ODS Application

ID: Q81341


The information in this article applies to:


SUMMARY

This article discusses a method to shut down the Open Data Services (ODS) application in a network independent way. This is analogous to shutting down SQL Server using the Transact-SQL command "shutdown [with nowait]".


MORE INFORMATION

The following steps describe the procedure:

  1. Trap a language message that requests a shutdown. Clients using the ODS application can issue a command that is intended to shut down the ODS application; for example, "Shutdown Gateway". The ODS application can intercept this command and shut down, instead of passing it over to the remote data source.

    In version 4.2, another possible way to handle this is to issue a remote stored procedure call.

    If a shutdown is issued, set a global flag indicating that the ODS application will be shutting down.


  2. In the event handlers for SRV_CONNECTION and SRV_LANGUAGE and any other additional event handlers (if any) that handle the results, code should be written to check for the global flag (set in step 1) before doing anything else.

    If the global flag is set, do the following:

    1. Send a message to the client notifying that client that the application is shutting down and the client should log out.


    2. Issue a srv_senddone to the client with SRV_DONE_FINAL and SRV_DONE_ERROR set.


    3. Issue a srv_event(SRV_DISCONNECT) for that client.




  3. Wait for x seconds to allow users to logout. The choice of x depends on the application programmer and the environment of the application.


  4. Issue a srv_event(SRV_STOP). This call shuts down all pipe connections and threads, and calls the user-defined code SRV_DISCONNECT.


NOTE: If you are running LAN Manager, you can write your application as a network service and start and stop it using the NET START and NET STOP commands.

Additional query words: 4.20


Keywords          : kbtool SSrvGen 
Version           : 4.2
Platform          : OS/2 
Issue type        : 

Last Reviewed: March 12, 1999