!--a11y-->
Architecture of the Locking Adapter
Service
The graphic shows the interfaces and how they are related to each other.

J2EE applications can only use the interfaces LogicalLocking and TableLocking, which are provided by the locking adapter. These have access to the locking manager that provides the ServerInternalLocking interface. This ensures that a J2EE application can only set or release locks for the current user using the application.
There are the following interfaces to set and release locks.
This interface is provided by the Locking Manager and offers the central functions.
Input parameters:
· Lock owner
· Lock name
· Lock argument
· Lock mode
Any lock can be set with this interface. It may only be used by the J2EE engine or by the LogicalLockinginterface.
With logical locking the owner cannot be specified. The system determines the owner, using the user or the transaction. What is used to determine the user can be specified in the parameter lifetime. After the transaction or the user session has finished, all associated locks are released.
A user session is ended when the user logs off or a timeout occurs.
A transaction ends when commit or rollback is called or when a timeout occurs.

A transaction does not have to end with the user session. If the user logs off without a commitor rollback having been called in the transaction, locks restricted to the transaction can continue to be effective until the transaction terminates with a timeout.

No locks can be set for the system user because of security reasons.
Input parameters:
· Lifetime of lock (running user session or running transaction)
· Lock name
· Lock argument
· Lock mode
Only your own locks can be changed. You can, however, still select the format and lock mode.
A table row can be locked in the database. The row is identified by the argument primaryKeys. The database connection is identified by the argument dbconnection.
Input parameters:
· Lifetime of lock (separate user session or transaction)
· Database connection (instance of SQL connection created from a data source that has a transaction in the deployment descriptor of the DB pool)
· Name of DB table
· Primary key of DB table
· Lock mode
·
You will find more
information and examples about working with locks in the developer’s
manual under
Locks.
· Detailed javadoc documentation can be accessed via the online help for SAP NetWeaver Developer Studio.
