[英]how to execute multi-threaded application as thread?
I have Java multi-threaded application which invokes one or more jobs(java code) using threads. 我有一个Java多线程应用程序,该应用程序使用线程调用一个或多个作业(java代码)。 This application has scheduled in cron tab and one or more instances of this application got invoked in particular point time. 该应用程序已在cron选项卡中进行了调度,并且在特定时间点调用了该应用程序的一个或多个实例。 It works well. 它运作良好。 In this case, it invoked as process. 在这种情况下,它作为流程调用。
Now, I've requirement to execute this application as thread. 现在,我需要将此应用程序作为线程执行。 I have some questions to be clarified 我有一些问题需要澄清
Any suggestions would be appreciated 任何建议,将不胜感激
I had to do exactly this task - for this purposes I used nailgun . 我必须严格执行此任务-为此,我使用了钉枪 。 It's an old software, but can do the job very well. 这是一个旧软件,但是可以很好地完成工作。 You will have only one JVM
and each java
program will run inside it, instead of a separate jvm
. 您将只有一个JVM
并且每个java
程序都将在其中运行,而不是单独的jvm
。
EDIT: You does not need to modify you program to use with nailgun
, even with singleton pattern since, as I remember, for each task(program) it use a separate classloader(be careful with memory leaks). 编辑:您无需修改程序即可与nailgun
一起使用,即使是单例模式也是如此,因为据我记得,对于每个任务(程序),它都使用单独的类加载器(请注意内存泄漏)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.