Class DefaultSemaphoreProvider

    • Constructor Detail

      • DefaultSemaphoreProvider

        public DefaultSemaphoreProvider()
    • Method Detail

      • create

        public Semaphore create​(com.broadleafcommerce.search.api.type.IndexableType type)
        Description copied from interface: SemaphoreProvider
        Creates a semaphore with zero permits.
        Specified by:
        create in interface SemaphoreProvider
        Parameters:
        type - the indexable type for which to create a new Semaphore
        Returns:
        the newly created Semaphore
      • create

        public Semaphore create​(com.broadleafcommerce.search.api.type.IndexableType type,
                                int permits)
        Description copied from interface: SemaphoreProvider
        Creates a semaphore with the given permits.
        Specified by:
        create in interface SemaphoreProvider
        Parameters:
        type - the indexable type for which to create a new Semaphore
        permits - the number of permits for the new Semaphore
        Returns:
        the newly created Semaphore
      • getCurrentSemaphore

        public Optional<Semaphore> getCurrentSemaphore​(com.broadleafcommerce.search.api.type.IndexableType type)
        Description copied from interface: SemaphoreProvider
        Looks for an existing semaphore and returns it if available.
        Specified by:
        getCurrentSemaphore in interface SemaphoreProvider
        Parameters:
        type - the indexable type for which to get the semaphore
        Returns:
        if present, the semaphore for the given indexable type
      • destroy

        public void destroy​(com.broadleafcommerce.search.api.type.IndexableType type)
        Description copied from interface: SemaphoreProvider
        Removes the semaphore from the local registry.
        Specified by:
        destroy in interface SemaphoreProvider
        Parameters:
        type - the indexable type for which to destroy the semaphore