JBoss 7中的多线程问题 [英] Multithread issue in JBoss 7

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

问题描述

我在jboss 7中遇到了关于多线程的问题(或者怀疑)。我的情况或多或少与描述的情况相似这里:我有一段代码运行在很多线程中,现在我必须将它移动到jboss服务器。唯一不同的是我不使用EJB,只是spring + hibernate。所以我的问题是:我是否应该按照答案中所写的步骤进行操作,还是有其他方法可以创建多个线程? (我正在探索jboss,并且有一些地方可以配置线程工厂和线程池,我不知道它是否可以在我的应用程序中使用的工具)

解决方案

不,不是真的。它的非法在Java EE和servlet规范下创建线程。您指向的链接是在Web / Java EE容器下执行线程的最简单方法 - 使用@Asynchronous。请注意,如果您想等待结果
,则可以使用此方法返回Future

I have got a problem (or doubt) about multithreading in jboss 7. My situation is more or less simillar to situation described here:I have got piece of code that is running in many threads and now I have to move it to jboss server. Only thing that is different is that I don't use EJB, just spring+hibernate. So my question is: should I follow the same steps as was written in the answer or there is any other way that I can create many threads? (I was exploring jboss and there was some place to configure thread factory and thread pools and I don't know if it is tool that I can use in my app)

解决方案

no, not really. its "illegal" to create threads in Java EE and under the servlet specifcation. the link you pointed to it the easiest way to do threading under a web/Java EE container - use @Asynchronous. note that you can return a Future from such a method if you want to wait for the results

这篇关于JBoss 7中的多线程问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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