When an item type’s caching mode is set to locked, the repository must obtain read or write locks to items before it can make them accessible to an application. Items that use locked caching mode can have one writer or multiple readers at a time.

Write Lock Request

When an application updates an item, the item’s repository requests a write lock from its ClientLockManager. If another transaction on the same Oracle ATG Web Commerce instance owns a write lock on the same item, the ClientLockManager can transfer the write lock, when available, to the pending request. Otherwise, it relays the request to its ServerLockManager, which determines whether it has any lock entries for the item. The ServerLockManager then processes the lock request as follows:

Existing lock entry

ServerLockManager action

None

Grants write lock request, creates write lock entry for the item.

Read

Asks ClientLockManagers to release their read locks on the item. When all read locks are released, grants the write lock request and creates a write lock entry for the item.

Write

Denies write lock request and adds the request to the queue of other pending requests for the item. Grants the request when the item becomes available.

Note: A write lock request always has precedence over pending read lock requests.

Read Lock Request

When an application looks up an item, the item’s repository requests a read lock from its ClientLockManager. The ClientLockManager relays this request to its ServerLockManager, which determines whether it already has any lock entries for the item. It then processes the lock request as follows:

Existing lock entry

ServerLockManager action

None

Grants read lock, creates read lock entry for the item.

Read

Grants read lock, adds this ClientLockManager to list of read locks for the item.

Write

Denies read lock and adds the read lock request to the queue of other pending read requests for the item. Grants the request when the item becomes available.

Processing Competing Lock Requests

When a transaction releases a write lock and multiple lock requests are pending for the locked item, the requests are processed in the following order:

Lock Lifespan

Lock ownership information is cached on the ClientLockManager as long as the item itself remains in the item cache. The lock can be passed among different transactions or threads on the Oracle ATG Web Commerce instance without informing the ServerLockManager.

A read lock remains valid until one of the following events occurs: