Java EE规范和多线程 [英] Java EE specification and multi threading

查看:122
本文介绍了Java EE规范和多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Struts和Spring编写Java EE应用程序。在其中一个操作中,存在大量数据库处理,因此存在性能问题。我想知道的是我可以在这里使用多线程吗?我认为Java EE规范不允许创建自定义线程,而不是由Server创建的线程(我使用Weblogic)。请引导我完成这个。

I am writing a Java EE application using Struts and Spring. In one of the operations there is heavy database processing, and hence performance issues. What I want to know is can I use multithreading here? I think the Java EE specification does not allow custom threads to be created apart from those created by Server (I use Weblogic). Please guide me through this.

推荐答案

这个问题偶尔出现。

根据规范,它未获得授权。要查看的最佳页面是:问答:J2EE限制

As per the spec it's not authorized. The best page to look at is this one: Q/A: J2EE Restrictions

也就是说,有一些方法可以产生线程,特别是在Weblogic中使用 WorkManager

That said, there are ways to spawn threads, especiall in Weblogic with the WorkManager.

请参阅以下问题:

  • How can an EJB parallelize a long, CPU intensive process?
  • Why spawning threads in J2EE container is discouraged?
  • J2EE programmers do not write to files

第一个目标EJB的事实不应该这么多,关于访问文件系统的最后一个是关于一般限制。

The fact that the first one targets EJB shouldn't matter that much, and the last one about access to file system is about general restrictions.

希望有所帮助。

这篇关于Java EE规范和多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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