-
- 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.Statuspublic classTaskPool.Companion
-
Field Summary
Fields Modifier and Type Field Description private 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
-
-
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
-
setStatus
final Unit setStatus(TaskPool.Status status)
-
getPriority
final Integer getPriority()
-
getProtocol
final String getProtocol()
-
getIsActive
final Boolean getIsActive()
-
getIsInactive
final Boolean getIsInactive()
-
getIsRetired
final Boolean getIsRetired()
-
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)
-
-
-
-