Class UnfiredCandidateActions


  • @Singleton
    public class UnfiredCandidateActions
    extends Object
    Contains all the CandidateCrawlActions that still have to be fired to get a result.
    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • locks

        private final com.google.common.util.concurrent.Striped<Lock> locks
      • crawlerLostCount

        private final com.codahale.metrics.Counter crawlerLostCount
      • unfiredActionsCount

        private final com.codahale.metrics.Counter unfiredActionsCount
    • Constructor Detail

      • UnfiredCandidateActions

        @Inject
        UnfiredCandidateActions​(BrowserConfiguration config,
                                javax.inject.Provider<StateFlowGraph> sfg,
                                com.codahale.metrics.MetricRegistry registry)
    • Method Detail

      • removeStateFromQueue

        private void removeStateFromQueue​(int id)
      • addActions

        public void addActions​(com.google.common.collect.ImmutableList<CandidateElement> extract,
                               StateVertex currentState)
        Parameters:
        extract - The actions you want to add to a state.
        currentState - The state you are in.
      • addActions

        void addActions​(Collection<CandidateCrawlAction> actions,
                        StateVertex state)
        Parameters:
        actions - The actions you want to add to a state.
        state - The state name. This should be unique per state.
      • isEmpty

        public boolean isEmpty()
        Returns:
        If there are any pending actions to be crawled. This method is not threadsafe and might return a stale value.
      • getNextNonDuplicate

        public StateVertex getNextNonDuplicate()
      • awaitNewTaskPriority

        public StateVertex awaitNewTaskPriority​(CrawlRules.CrawlPriorityMode crawlPriorityMode,
                                                boolean crawlNearDuplicates,
                                                boolean delayNearDuplicateCrawling)
                                         throws InterruptedException
        Parameters:
        crawlPriorityMode - the crawling modality
        crawlNearDuplicates - whether to consider near-duplicates
        delayNearDuplicateCrawling - whether to postpone the crawl of near-duplicates
        Returns:
        A new crawl task as soon as one is ready. Until then, it blocks.
        Throws:
        InterruptedException - when taking from the queue is interrupted.
      • purgeActionsForState

        public void purgeActionsForState​(StateVertex crawlTask)