4. Designing and Writing OpenROAD Server Applications : OpenROAD Application Requirements : How You Can Manage State in Private and Shared Servers
 
Share this page                  
How You Can Manage State in Private and Shared Servers
The Remote Server Initiate method can request either a private or shared server (shared is the default). This method would not typically be invoked directly; it would be invoked implicitly by a client side Name Server Connect() method that reads the Initiate parameters from the server side Name Server process. These configuration parameters are maintained using the Server Manager.
Using a private server avoids complications that can arise when interleaving concurrent requests from multiple clients in a shared server. However, the performance cost is high because a new server process must be launched each time a client calls the Remote Server Initiate method. Also, it is less scalable to large numbers of clients because each client must have a separate, dedicated server process on the server machine.
Using a shared server requires special care on the part of the application developer because remote 4GL procedure calls from different clients can be interleaved in any order. Simply maintaining state in global variables from one call to the next is not appropriate in this environment.
Remote calls are serialized, so that the 4GL need not manage concurrent threads within the scope of one remote call. However, the application must be designed to allow switching client context between one call and the next. This means that you must take care to associate the appropriate application state with the appropriate client. This can be achieved manually or through ASOLib. ASOLib contains components that automate application state switching.