RedisScheduler extends DuplicateRemovedScheduler implements MonitorableScheduler, DuplicateRemover { @Override public synchronized Request poll(Task task) { Jedis jedis = pool.getResource(); try { String url = jedis.lpop(getQueueKey(task)); if (url == null) { return null; } String key = ITEM_PREFIX + task.getUUID(); String field = DigestUtils.shaHex(url); byte[] bytes = jedis.hget(key.getBytes(), field.getBytes()); if (bytes != null) { Request o = JSON.parseObject(new String(bytes), Request.class); return o; } Request request = new Request(url); return request; } finally { pool.returnResource(jedis); } } RedisScheduler(String host);  RedisScheduler(JedisPool pool); @Override void resetDuplicateCheck(Task task); @Override boolean isDuplicate(Request request, Task task); @Override synchronized Request poll(Task task); @Override int getLeftRequestsCount(Task task); @Override int getTotalRequestsCount(Task task);  }
@Ignore("environment depended") @Test public void test() { Task task = new Task() { @Override public String getUUID() { return "1"; } @Override public Site getSite() { return null; } }; Request request = new Request("http: request.putExtra("1","2"); redisScheduler.push(request, task); Request poll = redisScheduler.poll(task); assertThat(poll).isEqualTo(request); }