Interface LockManager


public interface LockManager
The LockManager interface provides in memory locking services via its lock(String, String) and unlock(String, String) methods.

The LockManager is accessed using EbaseSystem.getLockManager().

Since:
V4.4
  • Method Summary

    Modifier and Type Method Description
    boolean isLockHeld​(java.lang.String resourceName, java.lang.String id)
    Returns true if the lock is held by another user, returns false if no lock exists or the lock is held by the user associated with the current thread.
    boolean lock​(java.lang.String resourceName, java.lang.String id)
    Locks the specified resource id so that it cannot be accessed by another user, returns false if the lock could not be obtained because it's held by another user, otherwise returns true.
    void unlock​(java.lang.String resourceName, java.lang.String id)
    Unlocks the specified resource id so that it can be accessed by another user.
  • Method Details

    • lock

      boolean lock​(java.lang.String resourceName, java.lang.String id)
      Locks the specified resource id so that it cannot be accessed by another user, returns false if the lock could not be obtained because it's held by another user, otherwise returns true. The unlock(String, String) method should be used to release the lock when it's no longer required.

      Locks are held in memory and are not persisted in any way; they are therefore not maintained across a server restart, or in a clustered environment. The system releases locks automatically when a form ends by the user navigating to the special final page, or when WebForm.gotoForm(String, java.util.Map) or WebForm.gotoUrl(String, java.util.Map) are called. In all other circumstances, locks must be explicitly released.

      Parameters:
      resourceName - resource name, can be any string of meaning to the calling program
      id - resource id, can be any string of meaning to the calling program
      Since:
      V4.4
      See Also:
      unlock(String, String)
    • unlock

      void unlock​(java.lang.String resourceName, java.lang.String id)
      Unlocks the specified resource id so that it can be accessed by another user.
      Parameters:
      resourceName - resource name, can be any string of meaning to the calling program
      id - resource id, can be any string of meaning to the calling program
      Since:
      V4.4
      See Also:
      lock(String, String)
    • isLockHeld

      boolean isLockHeld​(java.lang.String resourceName, java.lang.String id)
      Returns true if the lock is held by another user, returns false if no lock exists or the lock is held by the user associated with the current thread.
      Parameters:
      resourceName - resource name, can be any string of meaning to the calling program
      id - resource id, can be any string of meaning to the calling program
      Since:
      V4.4