mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
fixed bug
This commit is contained in:
parent
bd19c0733f
commit
72d733b8fb
@ -1,12 +1,18 @@
|
|||||||
package xyz.zinglizingli.common.listener;
|
package xyz.zinglizingli.common.listener;
|
||||||
|
|
||||||
|
import com.sun.javafx.tk.Toolkit;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
|
import org.springframework.scheduling.TaskScheduler;
|
||||||
|
import org.springframework.scheduling.config.Task;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import xyz.zinglizingli.common.crawl.BaseCrawlSource;
|
import xyz.zinglizingli.common.crawl.BaseCrawlSource;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -17,19 +23,18 @@ public class StartListener implements ApplicationListener<ContextRefreshedEvent>
|
|||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||||
log.info("程序启动");
|
log.info("程序启动");
|
||||||
|
crawlBook();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void crawlBook() {
|
||||||
while (true) {
|
new Timer().schedule(new TimerTask() {
|
||||||
try {
|
@Override
|
||||||
|
public void run() {
|
||||||
log.debug("crawlBooks执行中。。。。。。。。。。。。");
|
log.debug("crawlBooks执行中。。。。。。。。。。。。");
|
||||||
crawlSource.parse();
|
crawlSource.parse();
|
||||||
Thread.sleep(1000 * 60 * 5);
|
crawlBook();
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
|
},1000*60*5);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user