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 "Cache Concurrency", in Chapter 6 of the JADE Developer's Reference.

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

  1. 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.

  2. Click the OK button. Alternatively, click the Cancel button to abandon your selections.

You can also use the Object class methods summarized in the following table to define the volatility state of a specific object.

Method Description
changeObjectVolatility Changes the volatility of a persistent object
makeObjectFrozen Makes the specified persistent object frozen
makeObjectStable Makes the specified persistent object stable
makeObjectVolatile Makes the specified persistent object volatile

For details, see Volume 2 of the JADE Encyclopaedia of Classes.