Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Apache camel正在停止下载路由实例_Java_Multithreading_Apache Camel - Fatal编程技术网

Java Apache camel正在停止下载路由实例

Java Apache camel正在停止下载路由实例,java,multithreading,apache-camel,Java,Multithreading,Apache Camel,我目前是一个使用Apache Camel的初学者,我正在启动我的下载实例,然后让线程休眠一段时间,然后像下面这样停止,除了使用thread.sleep,还有更好的方法来处理这个问题吗 Main main = new Main(); main.addRouteBuilder(new MyFtpServerRouteBuilder()); main.enableHangupSupport(); //Starting my main camel instance

我目前是一个使用Apache Camel的初学者,我正在启动我的下载实例,然后让线程休眠一段时间,然后像下面这样停止,除了使用thread.sleep,还有更好的方法来处理这个问题吗

    Main main = new Main();
    main.addRouteBuilder(new MyFtpServerRouteBuilder());
    main.enableHangupSupport();
   //Starting my main camel instance
    main.start();
    Thread.sleep(10000);
   //stopping my main camel instance
    main.stop();
请参阅此常见问题解答

然后这就是如何保持Camel在独立模式下运行


尝试执行以下操作。这将运行camel上下文,直到终止或停止进程

public static void main(String... args) throws Exception {
    Main main = new Main();
    main.enableHangupSupport();
    main.addRouteBuilder(new MyFtpServerRouteBuilder());
    main.run(args);
}