我正在尝试使用camel 2.14版本实现从一个文件夹到另一个文件夹的简单文件轮询。我使用pollEnrich和基本计时器每30秒轮询一次。但每当我试图停止tomcat 7.0服务器时,我得到的日志为:
Catalina.logs
SEVERE: The web application [/CamelPoller] appears to have started a thread named [Camel (camel-1) thread #0 - timer://myTimer] but has failed to stop it. This is very likely to create a memory leak.
Aug 14, 2015 2:50:06 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/CamelPoller] appears to have started a thread named [Camel (camel-1) thread #1 - file://D:/Input] but has failed to stop it. This is very likely to create a memory leak.
FilePollerDemo.java
public class FilePollerDemo {
public FilePollerDemo() {
CamelContext context = new DefaultCamelContext();
try {
context.addRoutes(new RouteBuilder() {
public void configure() {
from("timer://myTimer?period=30000")
.pollEnrich("file://D:/Input?fileName=test.txt")
.to("file://D:/Output");
}
});
context.start();
// context.stop();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
我已经注释了context.stop()
,因为如果我使用它,文件轮询没有发生,或者如果我这样使用:
context.start();
thread.sleep(30000);
context.stop();
然后轮询器只运行一次。 请帮助我,我是骆驼的新手。