调用从Web服务器异步应用程序 [英] Calling an application from a web server asynchronously

查看:175
本文介绍了调用从Web服务器异步应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与Tomcat上运行的春天做了一个Web应用程序。在同一台机器上有一个正常的Java应用程序。

I have a web application made with Spring that runs on Tomcat. On the same machine there is a normal Java application.

我想从Web服务器调用它来执行Java应用程序,但我想使它所以应用程序将无法使用服务器的资源(它涉及一个分类的培训,因此它可能占用大量的资源和时间),它不能挂在服务器(所以它必须被异步调用)。

I would like to execute the Java application by calling it from the web server, but i want to make it so the application won't use the server's resources (it involves the training of a classifier so it may take up a lot of resources and time) and it must not hang the server (so it must be called asynchronously).

有没有办法做到这一点?

Is there any way to do that?

推荐答案

您有两种选择。


  1. 通过执行 EXEC ,并使用的Java 命令来启动一个单独的JVM实例。

  1. Start a separate JVM instance by doing a exec and using a java command.

生成一个新的线程 - 这将使用服务器的资源虽然

Spawn a new thread - this will use server's resources though.

您还可以结合选项1和2以及创建一个线程,做了 EXEC 电话。

You can also combine options 1 and 2 and create a thread that does the exec call.

这篇关于调用从Web服务器异步应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆