Enabling optimistic locking

You can enable an optimistic concurrency control scheme for CMP entity 1.x beans.

About this task

Concurrency control is the management of contention for data resources. A concurrency control scheme is considered pessimistic when it locks a given resource early in the data-access transaction and does not release it until the transaction is closed. A concurrency control scheme is considered optimistic when locks are acquired and released over a very short period of time at the end of a transaction.

The objective of optimistic concurrency is to minimize the time over which a given resource would be unavailable for use by other transactions. This is especially important with long-running transactions, which under a pessimistic scheme would lock up a resource for unacceptably long periods of time.

Under an optimistic scheme, locks are obtained immediately before a read operation and released immediately afterward. Update locks are obtained immediately before an update operation and held until the end of the transaction.

Procedure

  1. Switch to the Java™ EE perspective.
  2. In the Enterprise Explorer view, right-click the deployment descriptor, and select Open With > Deployment Descriptor Editor.
  3. On the Bean page of the editor, scroll to the Concurrency Control section.
  4. Select the Enable optimistic locking check box.

What to do next

For more information about optimistic locking and concurrency control, see the WebSphere® Application Server documentation.


Feedback