org.apache.manifoldcf.crawler.jobs
Class JobManager.ThrottleJobItem

java.lang.Object
  extended by org.apache.manifoldcf.crawler.jobs.JobManager.ThrottleJobItem
Enclosing class:
JobManager

protected static class JobManager.ThrottleJobItem
extends java.lang.Object

This class represents the information stored PER JOB in the throttling structure. In this structure, "remaining" counts are kept for each bin. When the bin becomes empty, then no more documents that would map to that bin will be returned, for this query. The way in which the maximum count per bin is determined is not part of this class.


Field Summary
protected  java.util.HashMap binCounts
          This is a map of the bins and their current counts.
protected  java.util.ArrayList throttleLimits
          These are the bin limits.
 
Constructor Summary
JobManager.ThrottleJobItem()
          Constructor.
 
Method Summary
 void addLimit(java.lang.String regexp, int maxCount)
          Add a bin limit.
 void decrement(java.lang.String binName)
          Decrement specified bin.
 JobManager.ThrottleJobItem duplicate()
          Create a duplicate of this item.
protected  int findMaxCount(java.lang.String binName)
          Given a bin name, find the max value for it using the regexps that are in place.
 boolean isEmpty(java.lang.String binName)
          Check if the specified bin is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

throttleLimits

protected java.util.ArrayList throttleLimits
These are the bin limits. This is an array of ThrottleLimitSpec objects.


binCounts

protected java.util.HashMap binCounts
This is a map of the bins and their current counts. If an entry doesn't exist, it's considered to be the same as maxBinCount.

Constructor Detail

JobManager.ThrottleJobItem

public JobManager.ThrottleJobItem()
Constructor.

Method Detail

addLimit

public void addLimit(java.lang.String regexp,
                     int maxCount)
Add a bin limit.

Parameters:
regexp - is the regular expression describing the bins to which the limit applies to.
maxCount - is the maximum number of fetches allowed for that bin.

duplicate

public JobManager.ThrottleJobItem duplicate()
Create a duplicate of this item.

Returns:
the duplicate.

isEmpty

public boolean isEmpty(java.lang.String binName)
Check if the specified bin is empty.

Parameters:
binName - is the bin name.
Returns:
true if empty.

decrement

public void decrement(java.lang.String binName)
Decrement specified bin.

Parameters:
binName - is the bin name.

findMaxCount

protected int findMaxCount(java.lang.String binName)
Given a bin name, find the max value for it using the regexps that are in place.

Parameters:
binName - is the bin name.
Returns:
the max count for that bin, or -1 if infinite.