SAP J2EE Engine

Version 6.40


com.sap.engine.services.applocking
Interface LogicalLocking

All Superinterfaces:
java.rmi.Remote

public interface LogicalLocking
extends java.rmi.Remote

Provides methods similar to the LockingContext, except that the owner may not be set explicitely. Instead the owner is automatically determined by the current user-session and the current transaction (every user-session/transaction has exactly one owner assigned). Because of this every method has instead of the parameter "owner" a parameter "lifetime", which determines which of the owners shall be used.

All locks are removed automatically when the session/transaction is ends.

Restriction: it is not alowed to make locks for the user-session of the system-user. This is done because of security-reasons.

Restriction: the parameter 'name' must always start with the namespace, for which this instance of the LogicalLocking was created (see LogicalLockingFactory). For example if the namespace is "XY", then valid names are "XY4711", "XY0815", "XYmeier".

See Also:
com.sap.engine.frame.core.locking.LockingContext

Method Summary
 void assertLifetime(byte lifetime)
          Returns if locking is currently allowed for the given lifetime.
 java.lang.String getCurrentOwner(byte lifetime)
          Returns the current owner-id, to which all locks belong.
 long getUniqueIncreasingNumber()
          Returns a number with the following properties: every method-call returns a higher number than the previous ones the number contains the timestamp of the central server, so this will work correctly in a distrubuted environment and also after a restart of the cluster This number can be used for every purpose, it is not locking-specific.
 void lock(byte lifetime, java.lang.String[] name, java.lang.String[] argument, char[] mode)
          Locks several arguments, which belong to a name.
 void lock(byte lifetime, java.lang.String[] name, java.lang.String[] argument, char[] mode, int timeout)
          Locks several arguments, which belong to a name.
 void lock(byte lifetime, java.lang.String name, java.lang.String argument, char mode)
          Locks an argument, which belongs to a name.
 void lock(byte lifetime, java.lang.String name, java.lang.String argument, char mode, int timeout)
          Locks an argument, which belongs to a name.
 void unlock(byte lifetime, java.lang.String[] name, java.lang.String[] argument, char[] mode)
          Unlocks a several arguments, which belongs to a name.
 void unlock(byte lifetime, java.lang.String[] name, java.lang.String[] argument, char[] mode, boolean asynchronous)
          Unlocks a several arguments, which belongs to a name.
 void unlock(byte lifetime, java.lang.String name, java.lang.String argument, char mode)
          Unlocks an argument, which belongs to a name.
 void unlock(byte lifetime, java.lang.String name, java.lang.String argument, char mode, boolean asynchronous)
          Unlocks an argument, which belongs to a name.
 void unlockAll(byte lifetime)
          Unlocks all names/arguments.
 void unlockAll(byte lifetime, boolean asynchronous)
          Unlocks all names/arguments.
 

Method Detail

lock

public void lock(byte lifetime,
                 java.lang.String name,
                 java.lang.String argument,
                 char mode)
          throws com.sap.engine.frame.core.locking.LockException,
                 com.sap.engine.frame.core.locking.TechnicalLockException,
                 java.lang.IllegalArgumentException
Locks an argument, which belongs to a name.
Parameters:
name - The name, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argument which to lock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The mode can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
Throws:
LockException - if the argument is already locked

lock

public void lock(byte lifetime,
                 java.lang.String name,
                 java.lang.String argument,
                 char mode,
                 int timeout)
          throws com.sap.engine.frame.core.locking.LockException,
                 com.sap.engine.frame.core.locking.TechnicalLockException,
                 java.lang.IllegalArgumentException
Locks an argument, which belongs to a name.
Parameters:
name - The name, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argument which to lock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The mode can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
timeout - time period in milliseconds within this the lock will be requested several times if there is a lock collision
Throws:
LockException - if the argument is already locked

lock

public void lock(byte lifetime,
                 java.lang.String[] name,
                 java.lang.String[] argument,
                 char[] mode)
          throws com.sap.engine.frame.core.locking.LockException,
                 com.sap.engine.frame.core.locking.TechnicalLockException,
                 java.lang.IllegalArgumentException
Locks several arguments, which belong to a name.
Parameters:
name - The names, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The arguments which to lock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The modes can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
timeout - time period in milliseconds within the lock will be requested several times if there is a lock collision
Throws:
LockException - if the argument is already locked

lock

public void lock(byte lifetime,
                 java.lang.String[] name,
                 java.lang.String[] argument,
                 char[] mode,
                 int timeout)
          throws com.sap.engine.frame.core.locking.LockException,
                 com.sap.engine.frame.core.locking.TechnicalLockException,
                 java.lang.IllegalArgumentException
Locks several arguments, which belong to a name.
Parameters:
name - The names, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The arguments which to lock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The modes can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
timeout - time period in milliseconds within the locks will be requested several times if there is a lock collision
Throws:
LockException - if the argument is already locked

unlock

public void unlock(byte lifetime,
                   java.lang.String name,
                   java.lang.String argument,
                   char mode)
            throws com.sap.engine.frame.core.locking.TechnicalLockException,
                   java.lang.IllegalArgumentException
Unlocks an argument, which belongs to a name. By default the unlock may be done asynchronously.
Parameters:
name - The name, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argument which to unlock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The mode can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.

unlock

public void unlock(byte lifetime,
                   java.lang.String name,
                   java.lang.String argument,
                   char mode,
                   boolean asynchronous)
            throws com.sap.engine.frame.core.locking.TechnicalLockException,
                   java.lang.IllegalArgumentException
Unlocks an argument, which belongs to a name.
Parameters:
name - The name, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argument which to unlock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The mode can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
asynchronous - If true, then the unlock may be done asynchronously, otherwise it is guaranteed to be done synchronously.

unlock

public void unlock(byte lifetime,
                   java.lang.String[] name,
                   java.lang.String[] argument,
                   char[] mode)
            throws com.sap.engine.frame.core.locking.TechnicalLockException,
                   java.lang.IllegalArgumentException
Unlocks a several arguments, which belongs to a name. By default the unlock may be done asynchronously.
Parameters:
name - The namea, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argumenta which to unlock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The modea can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.

unlock

public void unlock(byte lifetime,
                   java.lang.String[] name,
                   java.lang.String[] argument,
                   char[] mode,
                   boolean asynchronous)
            throws com.sap.engine.frame.core.locking.TechnicalLockException,
                   java.lang.IllegalArgumentException
Unlocks a several arguments, which belongs to a name.
Parameters:
name - The namea, to which the argument belongs. The maximum size is MAX_NAME_LENGTH characters.
argument - The argumenta which to unlock. The maximum size is MAX_ARGUMENT_LENGTH characters.
mode - The modea can be MODE_SHARED or MODE_EXCLUSIVE_CUMULATIVE or MODE_EXCLUSIVE_NONCUMULATIVE.
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
asynchronous - If true, then the unlock may be done asynchronously, otherwise it is guaranteed to be done synchronously.

unlockAll

public void unlockAll(byte lifetime)
               throws com.sap.engine.frame.core.locking.TechnicalLockException,
                      java.lang.IllegalArgumentException
Unlocks all names/arguments. By default the unlock may be done asynchronously.
Parameters:
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.

unlockAll

public void unlockAll(byte lifetime,
                      boolean asynchronous)
               throws com.sap.engine.frame.core.locking.TechnicalLockException,
                      java.lang.IllegalArgumentException
Unlocks all names/arguments.
Parameters:
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
asynchronous - If true, then the unlock may be done asynchronously, otherwise it is guaranteed to be done synchronously.

assertLifetime

public void assertLifetime(byte lifetime)
                    throws com.sap.engine.frame.core.locking.TechnicalLockException,
                           java.lang.IllegalArgumentException
Returns if locking is currently allowed for the given lifetime. For example LIFETIME_TRANSACTION is not possible, if there is no transaction active.

This method is typically not needed to use the locking. It is meant mainly for debugging-purposes and to support better tracing.

Parameters:
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.
Throws:
TechnicalLockException - if the lifetime is currently not allowed.

getCurrentOwner

public java.lang.String getCurrentOwner(byte lifetime)
                                 throws com.sap.engine.frame.core.locking.TechnicalLockException,
                                        java.lang.IllegalArgumentException
Returns the current owner-id, to which all locks belong. It is dependent on the current session or the current transaction.

This method is not needed to use the locking. It is meant mainly for debugging-purposes and to support better tracing.

Parameters:
lifetime - The lifetime can be either LIFETIME_TRANSACTION or LIFETIME_USERSESSION.

getUniqueIncreasingNumber

public long getUniqueIncreasingNumber()
                               throws com.sap.engine.frame.core.locking.TechnicalLockException
Returns a number with the following properties: This number can be used for every purpose, it is not locking-specific.

ATTENTION: if the system-time of the central server is changed this will probably not work correctly any more.


SAP J2EE Engine

Version 6.40


Copyright © 2001-2005 SAP AG. All Rights Reserved.