File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Can we use thread in ejbs ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can we use thread in ejbs ?" Watch "Can we use thread in ejbs ?" New topic

Can we use thread in ejbs ?

Vikas Kumar Sahu
Ranch Hand

Joined: Dec 02, 2003
Posts: 59
Hi java Gurus,
Can we use threads in session bean.
Actually I have to launch n threads and have processing logic for diffrent devices.
Or can we do in other way instead of multithreading.

Thnax in advance
Vikas Kumar Sahu
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
Hi Vikas,

Threads are not permitted in EJB according to the EJB Sepcs. but if any server permits that that is purely not following the specs.

And regarding the alternative what is ur requirement can u be a more brief on that, if I could help you.

Rahul Juneja

Rahul Juneja
ThoughtClicks -
adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
Ya Vikas according to the ejb specification threads are not permitted in ejb.
It is the container which takes care of all such issues.
So if u are using an App server which is according to the ejb specification u need not worry about threading.
Also if u have any specific requirement please tell where u would like to use threading.
Gabriel Buheler
Ranch Hand

Joined: Apr 21, 2004
Posts: 39
It is said not to use threds. No comment on that.

As an alternative approach I can suggest using Message-Driven Beans instead.

There are several characteristicts the way you can develop it. Depends on your business logic.

Good luck!

(SCJP, SCWCD, pursuing SCBCD)
I agree. Here's the link:
subject: Can we use thread in ejbs ?
It's not a secret anymore!