Package com.crawljax.core
Class UnfiredFragmentCandidates
- java.lang.Object
-
- com.crawljax.core.UnfiredFragmentCandidates
-
@Singleton public class UnfiredFragmentCandidates extends Object
Contains all theCandidateCrawlActions that still have to be fired to get a result.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanapplyNonSelAdvantageprivate Map<Integer,List<CandidateCrawlAction>>cacheprivate com.codahale.metrics.CountercrawlerLostCountprivate Map<Long,List<FormInput>>inputMapprivate com.google.common.util.concurrent.Striped<Lock>locksprivate static org.slf4j.LoggerLOGprivate static intMAX_REPEATprivate booleanrestoreConnectedEdgesprivate javax.inject.Provider<StateFlowGraph>sfgprivate booleanskipExploredActionsprivate List<CandidateCrawlAction>skipInputsprivate List<Eventable>skipInputsForPathprivate BlockingQueue<Integer>statesWithCandidatesprivate booleanunexploredStatesprivate com.codahale.metrics.CounterunfiredActionsCountprivate Map<Integer,List<CandidateCrawlAction>>unreachableCache
-
Constructor Summary
Constructors Constructor Description UnfiredFragmentCandidates(BrowserConfiguration config, javax.inject.Provider<StateFlowGraph> sfg, com.codahale.metrics.MetricRegistry registry, CrawlRules crawlRules)
-
Method Summary
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
MAX_REPEAT
private static int MAX_REPEAT
-
cache
private final Map<Integer,List<CandidateCrawlAction>> cache
-
statesWithCandidates
private final BlockingQueue<Integer> statesWithCandidates
-
locks
private final com.google.common.util.concurrent.Striped<Lock> locks
-
sfg
private final javax.inject.Provider<StateFlowGraph> sfg
-
crawlerLostCount
private final com.codahale.metrics.Counter crawlerLostCount
-
unfiredActionsCount
private final com.codahale.metrics.Counter unfiredActionsCount
-
unreachableCache
private final Map<Integer,List<CandidateCrawlAction>> unreachableCache
-
skipExploredActions
private boolean skipExploredActions
-
skipInputs
private final List<CandidateCrawlAction> skipInputs
-
applyNonSelAdvantage
private final boolean applyNonSelAdvantage
-
unexploredStates
private boolean unexploredStates
-
restoreConnectedEdges
private boolean restoreConnectedEdges
-
-
Constructor Detail
-
UnfiredFragmentCandidates
@Inject UnfiredFragmentCandidates(BrowserConfiguration config, javax.inject.Provider<StateFlowGraph> sfg, com.codahale.metrics.MetricRegistry registry, CrawlRules crawlRules)
-
-
Method Detail
-
getBestAction
private CandidateCrawlAction getBestAction(List<CandidateCrawlAction> availableActions, StateVertex state, FragmentManager fragmentManager)
-
pollActionOrNull
CandidateCrawlAction pollActionOrNull(StateMachine stateMachine, FragmentManager fragmentManager, boolean afterBacktrack)
-
rediscoveredState
void rediscoveredState(StateVertex state)
-
restoreState
private void restoreState(StateVertex state)
-
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(List<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.
-
awaitNewTask
public StateVertex awaitNewTask(StateVertex currentState, List<StateVertex> onURLSet, FragmentManager fragmentManager) throws InterruptedException
- Parameters:
fragmentManager-- Returns:
- A new crawl task as soon as one is ready. Until then, it blocks.
- Throws:
InterruptedException- when taking from the queue is interrupted.
-
awaitNewTask
public StateVertex awaitNewTask() throws InterruptedException
- Throws:
InterruptedException
-
getNextNonDuplicate
public StateVertex getNextNonDuplicate()
-
purgeActionsForState
public void purgeActionsForState(StateVertex crawlTask)
-
disableInputsForAction
public boolean disableInputsForAction(CandidateCrawlAction action)
-
shouldDisableInput
public boolean shouldDisableInput(CandidateCrawlAction action)
-
shouldDisableInput
public boolean shouldDisableInput(Eventable event)
-
disableInputsForPath
public void disableInputsForPath(Eventable event)
-
stateUpdated
public void stateUpdated(StateVertex crawlTask)
-
removeAction
public void removeAction(CandidateElement candidate, StateVertex state)
-
pollActionOrNull
CandidateCrawlAction pollActionOrNull(StateVertex state)
-
-