diff --git a/modules/core/src/com/haulmont/cuba/core/app/LockManagerAPI.java b/modules/core/src/com/haulmont/cuba/core/app/LockManagerAPI.java index 57e1c92727..4cddee89d9 100644 --- a/modules/core/src/com/haulmont/cuba/core/app/LockManagerAPI.java +++ b/modules/core/src/com/haulmont/cuba/core/app/LockManagerAPI.java @@ -18,13 +18,40 @@ public interface LockManagerAPI { String NAME = "cuba_LockManager"; + /** + * Try to lock object + * @param name locking object name + * @param id locking object ID + * @return
  • null in case of successful lock, + *
  • {@link com.haulmont.cuba.core.global.LockNotSupported} instance in case of locking is not configured for this object, + *
  • {@link LockInfo} instance in case of this object is already locked by someone + */ LockInfo lock(String name, String id); + /** + * Unlock object + * @param name locking object name + * @param id locking object ID + */ void unlock(String name, String id); + /** + * Get locking status for particular object + * @param name locking object name + * @param id locking object ID + * @return
  • null in case of no lock, + *
  • {@link com.haulmont.cuba.core.global.LockNotSupported} instance in case of locking is not configured for this object, + *
  • {@link LockInfo} instance in case of this object is locked by someone + */ LockInfo getLockInfo(String name, String id); + /** + * List of current locks + */ List getCurrentLocks(); + /** + * Process locks expiring. All expired locks will be removed. + */ void expireLocks(); } diff --git a/modules/global/src/com/haulmont/cuba/core/app/LockService.java b/modules/global/src/com/haulmont/cuba/core/app/LockService.java index a52b97e271..2f16046685 100644 --- a/modules/global/src/com/haulmont/cuba/core/app/LockService.java +++ b/modules/global/src/com/haulmont/cuba/core/app/LockService.java @@ -18,11 +18,35 @@ public interface LockService { String NAME = "cuba_LockService"; + /** + * Try to lock object + * @param name locking object name + * @param id locking object ID + * @return
  • null in case of successful lock, + *
  • {@link com.haulmont.cuba.core.global.LockNotSupported} instance in case of locking is not configured for this object, + *
  • {@link LockInfo} instance in case of this object is already locked by someone + */ LockInfo lock(String name, String id); + /** + * Unlock object + * @param name locking object name + * @param id locking object ID + */ void unlock(String name, String id); + /** + * Get locking status for particular object + * @param name locking object name + * @param id locking object ID + * @return
  • null in case of no lock, + *
  • {@link com.haulmont.cuba.core.global.LockNotSupported} instance in case of locking is not configured for this object, + *
  • {@link LockInfo} instance in case of this object is locked by someone + */ LockInfo getLockInfo(String name, String id); + /** + * List of current locks + */ List getCurrentLocks(); }