When loaded, an application has a flag indicating that the application is loaded because it was either loaded using the user interface (pulldown menus, tree, etc...) or was loaded using the XResult commands. UnloadApplication will not unload an application that has this flag set. In both cases, there is a high possibility that someone is still working with that application, so a human intervention is required to make sure that everyone is actually done.
Most of the "X" commands do not set the flag. This is because they are "discreet operations". This means that they load the application, do their work, and then are done - closing the application, all in one "command".
Human users and the XResultSet commands, may load an operation, perform many actions on that application, and it is unpredictable as to when they are going to be done. They are required to "close" the application to indicate completion.
Because many users or "X" commands can have an application open at a time, each loaded application also has a counter counting the number of "users" that have that application open. All of the "X" commands, and the user-interface of a client, increment this counter when opening and decrement it when closing. So, the discreet "X" command increment the counter when they start and decrement it before the command completes. The XResultSet commands increment on the commands (there are two) that open an application, and decrement on the command that closes an application. The user-interface increments when a client opens an application and decrement when they either close, switch applications, or exit the client.
If this counter is greater than one, when a close command arrives at the server, the server will not unload that application. It will simply decrement this counter, because there is some "user" still using that application.
There is a also a Sesame.ini file entry called "DATABASE RETENTION:" that causes Sesame server to retain a database as loaded, even after the counter has reached zero.
|