Class RssDetectionQueue


  • public class RssDetectionQueue
    extends Object
    A representation of the work queue on which RSS detection threads and RSS detection service are operating.
    • Constructor Detail

      • RssDetectionQueue

        public RssDetectionQueue()
    • Method Detail

      • enqueue

        public RssDetectionWork enqueue​(long repositoryId,
                                        @NotNull
                                        @NotNull VcsBranch vcsBranch,
                                        boolean force,
                                        @NotNull
                                        @NotNull SpecsConsumer specsConsumer)
        Enqueue work for a repository with the given Id and optional branch. Returns an instance of RssDetectionWork for future result reference.
        Parameters:
        repositoryId - id of the repository
        vcsBranch - optional branch to checkout and use to run Specs
        force - should the scan be executed even if there are no new commits
        specsConsumer - consumer used for importing Specs execution results
      • hasNext

        public boolean hasNext()
        Checks if there is any unit of work available for the RSS detection worker thread. Filters out work units for repositories which are currently being processed.
      • getNext

        public RssDetectionWork getNext()
        Retrieves the next unit of work for the RSS detection worker thread. Filters out work units for repositories which are currently being processed. Mutative operation. Throws if there's nothing available.

        Callee of this method becomes responsible for calling markDone(RssDetectionWork) once the work unit is completed or cancelled.

      • peekRemaining

        public List<RssDetectionWork> peekRemaining()
        Returns all the remaining work from this queue. Unlike hasNext() and getNext(), does not perform any filtering based on whether a repository is currently being processed or not. Non-mutative operation.
      • markDone

        public void markDone​(@NotNull
                             @NotNull RssDetectionWork detectionWork)
        Marks given work unit as finished.
      • shutdown

        public List<RssDetectionWork> shutdown()
        Registers shutdown of the RSS detection service and all the worker threads. Returns a list of all cancelled RSS detection work units.

        The RssDetectionWork entities are returned without any modifications. It's the callee's responsibility to update their state.

      • isShuttingDown

        public boolean isShuttingDown()
        Yields true if the RSS detection service is currently shutting down.
      • isInProgress

        public boolean isInProgress​(long vcsRepositoryId,
                                    @NotNull
                                    @NotNull VcsBranch vcsBranch)