Class TaskPool
-
- All Implemented Interfaces:
-
ai.platon.pulsar.common.config.Parameterized,kotlin.Comparable
public final class TaskPool implements Comparable<TaskPool>, Parameterized
This class handles FetchTasks which come from the same host ID (be it a proto/hostname or proto/IP pair).
It also keeps track of requests in progress and elapsed time between requests.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumTaskPool.Status
-
Field Summary
Fields Modifier and Type Field Description public final static IntegerRECENT_TASKS_COUNT_LIMITprivate final TaskPool.Statusstatusprivate final Integerpriorityprivate final Stringprotocolprivate final Stringhostprivate final BooleanisSlowprivate final BooleanisActiveprivate final BooleanisInactiveprivate final BooleanisRetiredprivate final IntegernumReadyTasksprivate final IntegernumPendingTasksprivate final IntegernumTotalFinishedTasksprivate final IntegernumSlowTasksprivate final DoubleaverageTimeprivate final DoubleaverageRecentTimeCostprivate final DoubleaverageTpsprivate final DoubleaverageRecentTpsprivate final StringtimeReportprivate final PoolIdidprivate final URLUtil.GroupModegroupMode
-
Method Summary
Modifier and Type Method Description final TaskPool.StatusgetStatus()If a fetch queue is inactive, the queue does not accept any tasks, nor serve any requests, but still hold pending tasks, waiting to finish final IntegergetPriority()final StringgetProtocol()final StringgetHost()final BooleanisSlow()final BooleanisActive()final BooleanisInactive()final BooleanisRetired()final IntegergetNumReadyTasks()final IntegergetNumPendingTasks()final IntegergetNumTotalFinishedTasks()final IntegergetNumSlowTasks()final DoublegetAverageTime()final DoublegetAverageRecentTimeCost()final DoublegetAverageTps()final DoublegetAverageRecentTps()final StringgetTimeReport()final PoolIdgetId()final URLUtil.GroupModegetGroupMode()Host group mode : can be by ip, by host or by domain ParamsgetParams()final Unitproduce(JobFetchTask task)Produce a task to this queue. final JobFetchTaskconsume()Ask a task from this queue. final Booleanfinish(Integer itemId, Boolean asap)final Booleanfinish(JobFetchTask fetchTask, Boolean asap)Note : We have set response time for each page, @see {HttpBase#getProtocolOutput} final JobFetchTaskgetPendingTask(Integer itemID)final BooleanhasTasks()final BooleanhasReadyTasks()final BooleanhasPendingTasks()final BooleanpendingTaskExists(Integer itemId)final BooleanisSlow(Duration threshold)final Unitenable()final Unitdisable()final Unitretire()final IntegerclearReadyQueue()final IntegerclearPendingQueue()final IntegerclearPendingTasksIfFew(Integer threshold)final Unitdump(Boolean drop)Booleanequals(Object other)IntegerhashCode()IntegercompareTo(TaskPool other)StringtoString()-
-
Method Detail
-
getStatus
final TaskPool.Status getStatus()
If a fetch queue is inactive, the queue does not accept any tasks, nor serve any requests, but still hold pending tasks, waiting to finish
-
getPriority
final Integer getPriority()
-
getProtocol
final String getProtocol()
-
isInactive
final Boolean isInactive()
-
getNumReadyTasks
final Integer getNumReadyTasks()
-
getNumPendingTasks
final Integer getNumPendingTasks()
-
getNumTotalFinishedTasks
final Integer getNumTotalFinishedTasks()
-
getNumSlowTasks
final Integer getNumSlowTasks()
-
getAverageTime
final Double getAverageTime()
-
getAverageRecentTimeCost
final Double getAverageRecentTimeCost()
-
getAverageTps
final Double getAverageTps()
-
getAverageRecentTps
final Double getAverageRecentTps()
-
getTimeReport
final String getTimeReport()
-
getGroupMode
final URLUtil.GroupMode getGroupMode()
Host group mode : can be by ip, by host or by domain
-
getParams
Params getParams()
-
produce
final Unit produce(JobFetchTask task)
Produce a task to this queue. Retired queues do not accept any tasks
-
consume
final JobFetchTask consume()
Ask a task from this queue. Retired queues do not assign any tasks
-
finish
final Boolean finish(JobFetchTask fetchTask, Boolean asap)
Note : We have set response time for each page, @see {HttpBase#getProtocolOutput}
-
getPendingTask
final JobFetchTask getPendingTask(Integer itemID)
-
hasReadyTasks
final Boolean hasReadyTasks()
-
hasPendingTasks
final Boolean hasPendingTasks()
-
pendingTaskExists
final Boolean pendingTaskExists(Integer itemId)
-
clearReadyQueue
final Integer clearReadyQueue()
-
clearPendingQueue
final Integer clearPendingQueue()
-
clearPendingTasksIfFew
final Integer clearPendingTasksIfFew(Integer threshold)
-
-
-
-