public class RedisScheduler extends DuplicateRemovedScheduler implements MonitorableScheduler, DuplicateRemover
Modifier and Type | Field and Description |
---|---|
protected redis.clients.jedis.JedisPool |
pool |
logger
Constructor and Description |
---|
RedisScheduler(redis.clients.jedis.JedisPool pool) |
RedisScheduler(String host) |
Modifier and Type | Method and Description |
---|---|
protected String |
getItemKey(Task task) |
int |
getLeftRequestsCount(Task task) |
protected String |
getQueueKey(Task task) |
protected String |
getSetKey(Task task) |
int |
getTotalRequestsCount(Task task)
Get TotalRequestsCount for monitor.
|
boolean |
isDuplicate(Request request,
Task task)
Check whether the request is duplicate.
|
Request |
poll(Task task)
get an url to crawl
|
protected void |
pushWhenNoDuplicate(Request request,
Task task) |
void |
resetDuplicateCheck(Task task)
Reset duplicate check.
|
getDuplicateRemover, noNeedToRemoveDuplicate, push, setDuplicateRemover, shouldReserved
public RedisScheduler(String host)
public RedisScheduler(redis.clients.jedis.JedisPool pool)
public void resetDuplicateCheck(Task task)
DuplicateRemover
resetDuplicateCheck
in interface DuplicateRemover
task
- taskpublic boolean isDuplicate(Request request, Task task)
DuplicateRemover
isDuplicate
in interface DuplicateRemover
request
- requesttask
- taskprotected void pushWhenNoDuplicate(Request request, Task task)
pushWhenNoDuplicate
in class DuplicateRemovedScheduler
public Request poll(Task task)
Scheduler
public int getLeftRequestsCount(Task task)
getLeftRequestsCount
in interface MonitorableScheduler
public int getTotalRequestsCount(Task task)
DuplicateRemover
getTotalRequestsCount
in interface DuplicateRemover
getTotalRequestsCount
in interface MonitorableScheduler
task
- taskCopyright © 2017. All rights reserved.