PreviousNext

Manager Initialization

Server initialization tasks can typically be divided between essentially generic initialization - creating bindings, establishing security state, exporting to a name service, and listening for calls, among other things - and manager-specific initialization. (Remember that management refers to a set of tasks to control a server while a manager is a server's implementation of a set of operations from one or more interfaces.)

Once the server has called rpc_server_listen( ), the manager operations may be called asynchronously. The application may, however, need to perform some initialization before any manager operations are performed. For example, the sample storage manager (code example context_manager.c) needs to initialize its tables before any storage can be allocated out of them. An application has three choices about manager initialization policy:

1. The server can perform manager initialization before calling rpc_server_listen( ).

2. The server can have the first instance of a manager operation thread perform manager initialization, using the pthread_once( ) facility. Although initializing everything prior to listening for remote procedure calls is more straight-forward programming, some applications might benefit from this threaded approach. For example, those operations that do not need the initialization could forgo use of the pthread_once( ) facility. This is the approach demonstrated in the sample storage manager.

3. The server can export manager initialization operations as part of its application-specific management interface, and have a management client perform the initialization.

Options 1 and 2 have similar effects and are appropriate for most servers. Option 3 might be appropriate for a persistent server where reinitialization of the running server is a useful operation. Such an operation is a perfect candidate for inclusion in an application-specific management interface for a persistent server.