PMDF Programmer's Reference Manual


Previous Next Contents Index

1.7 Programs that Run Indefinitely

Special attention must be given to programs that can run indefinitely. An example of such a program might be a server that continually listens for incoming mail connections and enqueues any received mail to PMDF. The following discussion is concerned with such programs. Programs which run and merely submit a few messages, loop over a queue of messages and then exit, or user interfaces should not take the steps described in this section.a

When PMDFinitialize is called, site-specific configuration information is loaded. The life span of this information usually far exceeds the running time of a program that uses it. However, this isn't the case for a program that can run for weeks or months. When PMDF configuration information changes, these programs need to be made aware of the change so that they can reload this information. Subsequent calls to PMDFdone and PMDFinitialize will not accomplish this task: a program must exit and restart in order to ensure that all configuration information is reloaded.

Also, a program which enqueues or dequeues messages will open the queue cache database and possibly the PMDF log file, mail.log_current. Care must be taken to ensure that these files are not left open during periods of inactivity. Leaving these files open might block activities that require exclusive access to those files. Programs which run indefinitely enqueuing or dequeuing messages should always call PMDFcloseQueueCache, PMDFcloseLogFile, and, if doing message dequeue activity, PMDFdequeueEnd before going idle. The queue cache and log file will be automatically reopened when needed. The queue cache should not be closed while in the middle of dequeue processing; i.e., PMDFcloseQueueCache should not be called while looping over messages in a message queue with PMDFgetMessage. PMDFcloseQueueCache should be called after PMDFgetMessage has returned a PMDF__EOF status and before again calling PMDFdequeueInitialize.

1.7.1 OpenVMS Considerations

The PMDF RESTART command is used after a change to the PMDF configuration to restart components of PMDF which run indefinitely. In addition, the PMDF CACHE/CLOSE command is used to force components of PMDF to close the queue cache database should they have it open. One such component of PMDF is BN_SLAVE. This component is a slave channel program which runs as a detached process. It starts running at system startup and continues to run, processing incoming BITNET mail, until Jnet or the system is shut down. When configuration changes are made or the queue cache needs to be rebuilt, a PMDF RESTART command is issued to inform BN_SLAVE of this fact. BN_SLAVE then either exits and restarts or closes the queue cache database at its earliest convenience.

The routine PMDFsetCallBack provides a communication path whereby a running program can be notified when a PMDF RESTART, PMDF SHUTDOWN, or PMDF CACHE/CLOSE command has been issued. When a RESTART or SHUTDOWN command is issued, a running program should note this fact and, as soon as is convenient, exit and restart or simply exit. In response to a CACHE/CLOSE command, the queue cache should be closed as soon as it is convenient to do so. This is accomplished with the PMDFcloseQueueCache routine. The cache will be reopened automatically when it is again needed. This is generally done by PMDFenqueueMessage and PMDFgetMessage. The queue cache should not be closed while in the middle of dequeue processing; i.e., it should not be called while looping over messages in a message queue. PMDFcloseQueueCache should be called after PMDFgetMessage has returned a PMDF__EOF status and before again calling PMDFdequeueInitialize.

On OpenVMS systems, the communication path established by PMDFsetCallBack is implemented using cluster-wide resource locks. Thus, PMDF RESTART and PMDF SHUTDOWN commands issued anywhere on an OpenVMS cluster will be seen by all users of PMDFsetCallBack throughout the cluster.

1.7.2 UNIX & Windows Considerations

On UNIX and Windows systems, the PMDFsetCallBack facility is non-functional. Calls to it will merely return PMDF__OK without doing anything. Likewise for the PMDFcancelCallBack routine.

Also on UNIX and Windows systems, the pmdf restart and shutdown commands cannot be used to restart or shutdown site-supplied API clients. Such clients must supply their own mechanism for being signalled to either restart or shutdown.

Note

a User interfaces should specify false (0) for the ischannel argument to PMDFinitialize.


Previous Next Contents Index