Interface ResourceLockProvider

  • All Known Implementing Classes:
    ExternalResourceLockProvider

    public interface ResourceLockProvider
    Provides the ability to lock and unlock resources.
    Author:
    Jacob Mitash
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String obtainLock​(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 Detail

      • 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 lock
        conceptKey - some key indicating what is being locked or by who
        contextInfo - 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 via obtainLock(String, String, ContextInfo).
        Parameters:
        token - the token tied to the lock which should be released
        contextInfo - the context of the request