Class GeneralLockServiceImpl
- java.lang.Object
-
- org.craftercms.studio.impl.v1.service.GeneralLockServiceImpl
-
- All Implemented Interfaces:
GeneralLockService
public class GeneralLockServiceImpl extends Object implements GeneralLockService
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,ReentrantLock>
nodeLocks
-
Fields inherited from interface org.craftercms.studio.api.v1.service.GeneralLockService
MASTER_LOCK
-
-
Constructor Summary
Constructors Constructor Description GeneralLockServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
lock(String objectId)
void
lockContentItem(String siteId, String path)
Lock content item for synchronized access.@javax.validation.Valid boolean
tryLock(String objectId)
boolean
tryLockContentItem(String siteId, String path)
Try to lock item for synchronized access.void
unlock(String objectId)
void
unlockContentItem(String siteId, String path)
Release lock on content item.
-
-
-
Field Detail
-
nodeLocks
protected Map<String,ReentrantLock> nodeLocks
-
-
Method Detail
-
lock
@Valid public void lock(String objectId)
- Specified by:
lock
in interfaceGeneralLockService
-
tryLock
@Valid public @javax.validation.Valid boolean tryLock(String objectId)
- Specified by:
tryLock
in interfaceGeneralLockService
-
unlock
@Valid public void unlock(String objectId)
- Specified by:
unlock
in interfaceGeneralLockService
-
lockContentItem
public void lockContentItem(String siteId, String path)
Description copied from interface:GeneralLockService
Lock content item for synchronized access. Thread is blocked until lock is obtained.- Specified by:
lockContentItem
in interfaceGeneralLockService
- Parameters:
siteId
- site identifierpath
- content item path
-
tryLockContentItem
public boolean tryLockContentItem(String siteId, String path)
Description copied from interface:GeneralLockService
Try to lock item for synchronized access. If lock obtained returns true, otherwise false. Does not block thread if not available lock.- Specified by:
tryLockContentItem
in interfaceGeneralLockService
- Returns:
-
unlockContentItem
public void unlockContentItem(String siteId, String path)
Description copied from interface:GeneralLockService
Release lock on content item.- Specified by:
unlockContentItem
in interfaceGeneralLockService
- Parameters:
siteId
- site identifierpath
- path of the content item
-
-