Interface ResourceLockProvider
- All Known Implementing Classes:
ExternalResourceLockProvider
public interface ResourceLockProvider
Provides the ability to lock and unlock resources.
- Author:
- Jacob Mitash
-
Method Summary
Modifier and TypeMethodDescriptionobtainLock
(String contextId, String conceptKey, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Obtains a resource lock.void
releaseLock
(String token, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Releases a resource lock using a token.
-
Method Details
-
obtainLock
String obtainLock(String contextId, String conceptKey, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Obtains a resource lock.- Parameters:
contextId
- the context ID of the entity to lockconceptKey
- some key indicating what is being locked or by whocontextInfo
- the context of the request- Returns:
- a token that can be used to release the lock
-
releaseLock
void releaseLock(String token, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Releases a resource lock using a token. The token should be obtained viaobtainLock(String, String, ContextInfo)
.- Parameters:
token
- the token tied to the lock which should be releasedcontextInfo
- the context of the request
-