Class RssDetectionQueue
- java.lang.Object
-
- com.atlassian.bamboo.configuration.external.detection.RssDetectionQueue
-
public class RssDetectionQueue extends Object
A representation of the work queue on which RSS detection threads and RSS detection service are operating.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RssDetectionQueue.RssDetectionWorkKey
Key of a single work unit used for avoiding redundant RSS detections per repository and branch
-
Constructor Summary
Constructors Constructor Description RssDetectionQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RssDetectionWork
enqueue(long repositoryId, @NotNull VcsBranch vcsBranch, boolean force, @NotNull SpecsConsumer specsConsumer)
Enqueue work for a repository with the given Id and optional branch.RssDetectionWork
getNext()
Retrieves the next unit of work for the RSS detection worker thread.boolean
hasNext()
Checks if there is any unit of work available for the RSS detection worker thread.boolean
isInProgress(long vcsRepositoryId, @NotNull VcsBranch vcsBranch)
boolean
isShuttingDown()
Yields true if the RSS detection service is currently shutting down.void
markDone(@NotNull RssDetectionWork detectionWork)
Marks given work unit as finished.Set<RssDetectionQueue.RssDetectionWorkKey>
peekAllQueued()
Returns all work from this queue, i.e.List<RssDetectionWork>
peekRemaining()
Returns all the remaining work from this queue.List<RssDetectionWork>
shutdown()
Registers shutdown of the RSS detection service and all the worker threads.
-
-
-
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 ofRssDetectionWork
for future result reference.- Parameters:
repositoryId
- id of the repositoryvcsBranch
- optional branch to checkout and use to run Specsforce
- should the scan be executed even if there are no new commitsspecsConsumer
- 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()
-
peekAllQueued
public Set<RssDetectionQueue.RssDetectionWorkKey> peekAllQueued()
Returns all work from this queue, i.e. all remaining work as well as work in progress. 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)
-
-