简体   繁体   English

是否提供了在诸如Liferay的JSR 286 Portlet容器中使用并发后台进程的规定?

[英]Is there a provision for using concurrent background processes in JSR 286 portlet containers like Liferay?

I need to write a portlet for Liferay 6.1 (Tomcat 7) which requires some background threads for efficiency and completeness. 我需要为Liferay 6.1(Tomcat 7)写一个portlet,它需要一些后台线程来提高效率和完整性。

The portlet app needs to regularly poll for information from an external server before it updates its internal state, and then update the UI if one exists. Portlet应用程序需要在更新其内部状态之前定期从外部服务器轮询信息,然后更新UI(如果存在)。

I am not sure about the context in which a thread will run in Liferay. 我不确定线程​​将在Liferay中运行的上下文。

Nothing prevents you from launching a background Thread in a Java EE app server. 没有什么可以阻止您在Java EE应用服务器中启动后台线程。 It's just not recommended because the lifecycle of the thread is unknown to the application server and can lead to unexpected exceptions. 只是不建议这样做,因为线程的生命周期对于应用程序服务器是未知的,并且可能导致意外的异常。

I would recommend reading this post, What is recommended way for spawning threads from a servlet in Tomcat 我建议阅读这篇文章“ 从Tomcat中的servlet产生线程的推荐方法”

and especially the response regarding Common-J JSR 237 尤其是关于Common-J JSR 237的响应

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM