public class ExternalResourceLockProvider extends AbstractExternalProvider implements ResourceLockProvider
Constructor and Description |
---|
ExternalResourceLockProvider(org.springframework.web.reactive.function.client.WebClient webClient,
com.fasterxml.jackson.databind.ObjectMapper objectMapper,
com.broadleafcommerce.common.extension.TypeFactory typeFactory,
ExternalCartProperties properties) |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
executeRequest(Supplier<T> request)
Executes a request with default Web Client error handling.
|
String |
obtainLock(@NonNull String contextId,
@NonNull String conceptKey,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Obtains a resource lock.
|
void |
releaseLock(@NonNull String token,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Releases a resource lock using a token.
|
getHeaders, getObjectMapper, getTypeFactory, getWebClient, pageableToParams, uriVars
public ExternalResourceLockProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalCartProperties properties)
public String obtainLock(@NonNull @NonNull String contextId, @NonNull @NonNull String conceptKey, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
ResourceLockProvider
obtainLock
in interface ResourceLockProvider
contextId
- the context ID of the entity to lockconceptKey
- some key indicating what is being locked or by whocontextInfo
- the context of the requestpublic void releaseLock(@NonNull @NonNull String token, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
ResourceLockProvider
ResourceLockProvider.obtainLock(String, String, ContextInfo)
.releaseLock
in interface ResourceLockProvider
token
- the token tied to the lock which should be releasedcontextInfo
- the context of the requestprotected <T> T executeRequest(Supplier<T> request)
AbstractExternalProvider
executeRequest
in class AbstractExternalProvider
T
- the return type of the request operationrequest
- the request to executeCopyright © 2021. All rights reserved.