package com.;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
/**
*
* @author
* 2
*/
public class WarnningLog {
private static CrawlerRoundLogDao roundLogDao = new CrawlerRoundLogDao();
private static SpiderWarningLogDao warnDao = new SpiderWarningLogDao();
public static void sumWarningLog(final CrawlerBean crawler){
Runnable runnable = new Runnable() {
@Override
public void run() {
//这里面是需要实现的代码
}
};
}
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
/**
*
* @author
* 2
*/
public class WarnningLog {
private static CrawlerRoundLogDao roundLogDao = new CrawlerRoundLogDao();
private static SpiderWarningLogDao warnDao = new SpiderWarningLogDao();
public static void sumWarningLog(final CrawlerBean crawler){
Runnable runnable = new Runnable() {
@Override
public void run() {
//这里面是需要实现的代码
}
};
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
//1为延迟执行的时间。50为每轮的时间50*时间单位,TimeUtit.SECONDS 表示时间以秒计时,这里表示50表执行一次,
//TimeUnit.SECONDS 可以以小时计时,TimeUnit.HOURS,分钟同理
}
}
**********************
在其他方法里 直接调用这个静态方法即可