Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

job.executor可以提供一个不依赖容器的版本,使用JVM环境 #35

Closed
whcWang opened this issue Mar 23, 2017 · 4 comments
Closed

Comments

@whcWang
Copy link

whcWang commented Mar 23, 2017

现在的executor需要依赖容器,可以考虑打成jar,在JVM中跑,脱离对web容器的依赖:

我昨天实现了一下:

通过maven 的maven-shade-plugin插件,在JVM中直接跑

main函数:

new Thread() {
			public void run() {
				synchronized (StatisticApp.class) {
					new ClassPathXmlApplicationContext("classpath:di-statistic.springContext.xml");
				}
				try {
					while (true) {
						LOG.info(GlobalConst.LogFix.LOG_FIX_PREFIX + "di-statistic is running....");
						Thread.sleep(THREAD_SLEEP_TIME);
					}
				} catch (InterruptedException e) {
					LOG.error(GlobalConst.LogFix.LOG_FIX_PREFIX + "di-statistic throws exception:");
					LOG.error(GlobalExceptionMsg.getExceptionMessage(e));
				}
			}
		}.start();
@maventalker
Copy link

@whcWang 代码量大的话,建议使用maven-assembly-plugin插件。

@xuxueli
Copy link
Owner

xuxueli commented May 18, 2017

赞!
哈哈,这下大家清楚为什么执行器需要内嵌jetty了吧?

@zsf513
Copy link

zsf513 commented Aug 24, 2017

执行器可否做成不内嵌jetty?可否做成一个jar包依赖(比如叫xxl-job-executor-server),需要的时候引入,不需要的时候可用使用应用自身的容器。
目前我的项目是用的springboot,已经内嵌了tomcat,不想再内嵌一个jetty(虽然项目能正常运行)。

@carvendy
Copy link

嵌套jetty 就是想利用它里面的nio的特性吧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants