Show TOC

Background documentationWorking with the LogicalLocking API Locate this document in the navigation structure

 

As a generic interface, the LogicalLocking interface enables the locking of any field, such as an application object, represented as a character string. To avoid unintentional lock collision between different AS Java components (applications, services, or managers), an additional lock parameter called namespace separates locks managed by different applications. The following string parameters identify an application object to be locked:

  • namespace

    The namespace uniquely identifies a set of names.

  • name

    The name determines an object category in the namespace, for example "building".

  • argument

    The argument represents the value of the object to be locked, for example "xyz".

A namespace is identified by its description. To share the same locks, involved application components:

  1. Agree on character strings for a namespace and for its description.

  2. Reserve a namespace, that is, obtain the LogicalLocking instance that serves this concrete namespace.

After reserving a namespace, application components can invoke methods on the LogicalLocking instance obtained to lock and unlock objects within the namespace. Several predefined values for an additional lock parameter mode can be used to request an appropriate lock type according to the agreed locking protocol.

Each lock request implies remote communication between a server node and the Enqueue Server. You can minimize the remote communication by locking and unlocking entire blocks of application objects in a single lock request, for example by inquiring several locks in one request or by applying wildcards within the name and argument parameter of application objects.

The com.sap.engine.services.applocking.LogicalLocking interface defines the LogicalLocking API. The Application Locking Service provides access to a LogicalLockingFactory using JNDI. Using the factory you can create an instance of the LogicalLocking API.

For more information, see:

Getting a LogicalLocking Instance

Setting Locks with the LogicalLocking API

Releasing Locks with the LogicalLocking API