Maintaining Class Instance Volatility
The Volatility sheet of the Define Class dialog is displayed when you select the Volatility sheet of the dialog. This enables you to maintain the volatility of all instances of a class; that is, to optimize locking based on the frequency at which class instances are updated.
By default, class instances are volatile; that is, class instances are often updated. For details, see "
The Schema Inspector displays class and object volatility by default, which enables you to check whether objects and collections are set to stable or frozen without having to write code to determine the volatility state of an object or collection.
To maintain the volatility of all instances in the class
-
In the Instance Volatility group box, select the:
-
Stable option button if you want to specify that class instances are updated infrequently
-
Frozen option button if you want to specify that class instances are not updated
Acquiring shared locks for stable objects incurs much less overhead, at the expense of extra cost when acquiring an exclusive lock. However, as stable objects are updated infrequently, exclusive locks are not often required.
The main benefit of using frozen objects is for iterating collections. The implicit shared lock requests associated with iterating are ignored, avoiding the overhead that would otherwise be involved.
-
-
Click the OK button. Alternatively, click the Cancel button to abandon your selections.
You can also use the
Method | Description |
---|---|
|
Changes the volatility of a persistent object |
|
Makes the specified persistent object frozen |
|
Makes the specified persistent object stable |
|
Makes the specified persistent object volatile |
For details, see