Interface SemaphoreProvider
- All Known Implementing Classes:
DefaultSemaphoreProvider
public interface SemaphoreProvider
Simple interface to provide shared access to a Semaphore.
- Author:
- Kelly Tisdell
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(com.broadleafcommerce.search.api.type.IndexableType type) Creates a semaphore with zero permits.create
(com.broadleafcommerce.search.api.type.IndexableType type, int permits) Creates a semaphore with the given permits.void
destroy
(com.broadleafcommerce.search.api.type.IndexableType type) Removes the semaphore from the local registry.getCurrentSemaphore
(com.broadleafcommerce.search.api.type.IndexableType type) Looks for an existing semaphore and returns it if available.
-
Method Details
-
create
Creates a semaphore with zero permits.- Parameters:
type
- the indexable type for which to create a new Semaphore- Returns:
- the newly created Semaphore
- Throws:
IllegalStateException
- if a semaphore has already been created for the IndexableType
-
create
Creates a semaphore with the given permits.- Parameters:
type
- the indexable type for which to create a new Semaphorepermits
- the number of permits for the new Semaphore- Returns:
- the newly created Semaphore
- Throws:
IllegalStateException
- if a semaphore has already been created for the IndexableType
-
getCurrentSemaphore
Looks for an existing semaphore and returns it if available.- Parameters:
type
- the indexable type for which to get the semaphore- Returns:
- if present, the semaphore for the given indexable type
-
destroy
void destroy(com.broadleafcommerce.search.api.type.IndexableType type) Removes the semaphore from the local registry.- Parameters:
type
- the indexable type for which to destroy the semaphore
-