Start of Content Area

This graphic is explained in the accompanying textShared Locks  Locate the document in its SAP Library structure

Concept

Shared locks are used to synchronize changes to shared objects across all VMs located on the same server instance. The synchronize&wait pattern in the classic Java language uses language constructs (synchronize(), wait()) to make Java threads wait for each other while an object is accessed in the local heap memory. This however only works within one VM.

When Java objects are changed in the shared memory of the VM Container, you need a similar mechanism everywhere where data consistency between the VMs must be guaranteed (typical case is when an application's configuration is changed).

Integration

Since an instance of the SharedLock class can be used by all the VMs belonging to one instance (“shareable”), it can be used in Shared Closures.

Design

Shared locks are implemented as the SharedLock class.

The user (Java programmer) can therefore obtain a new (or existing) shared lock instance through an internal API, and then with a method call define the secure code route to be executed basically. The VMC makes sure that only one VM is active in this secure code block at any one time. All other VMs wanting to enter this block must wait until the active VM has left the block.

Further Information

You can display the existing shared locks in the VMC System Administration (transaction SM53).

In the VM Overview (transaction SM52) you can display statistical information about shared locks.

 

End of Content Area