@Override
public void run() {
boolean isSuccess = true;
try {
jedis = pool.getResource();
jedis.select(0);
while(true){
long startTime = System.currentTimeMillis(); //
int index = 0;
while (index < list.size()) {
String url = list.get(index);
logger.info(url);
try {
crawURL(url);
} catch (IOException
| URISyntaxException e1) {
e1.printStackTrace();
}
try {
Thread.currentThread();
Thread.sleep(1500);
} catch (InterruptedException e) {
e.printStackTrace();
}
index++;
}
}
} catch (JedisConnectionException e) {
isSuccess= false;
if (jedis != null)
pool.returnBrokenResource(jedis);
} finally {
if (isSuccess)
pool.returnResource(jedis);
}
}