File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes BEA/Weblogic and the fly likes Problem in Join() with user threads in weblogic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Problem in Join() with user threads in weblogic" Watch "Problem in Join() with user threads in weblogic" New topic

Problem in Join() with user threads in weblogic

Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
I have got an EJB deployed in webogic 9.2 environment in which we are creating
a new Thread .In the EJB after starting the thread i have written
Thread th=new Thread(new SomeJob());



}catch(InterruptedException iex)


if the thread executes normally ( i mean their is no problem in the Thread) in this case , My EJB code waits for the
thread to finish till the specified time interval in milli seconds and after that
EJB code executes which fulfills my requirement.

But the problem is if the thread executes above the configured StuckThreadMaxTime(600sec), then weblogic throws an ecxception but code in the EJB is not executed even though it should because thead is no more.

Don't know what's going on???

please give some inputs on this


Joe Ess

Joined: Oct 29, 2001
Posts: 9190

Creating threads in an EJB is a Bad Idea:
If application components contain the same functionality
provided by J2EE system infrastructure, there are clashes and mis-management of the functionality.
For example, if enterprise beans were allowed to manage threads, the J2EE
platform could not manage the life cycle of the enterprise beans, and it could not properly manage transactions.

J2EE 1.4 Specification section 6.2.1 Programming Restrictions

The usual way to handle a long-running process in a web application is to return a message to the user immediately and hand the request off to a non-web client. Once the request has been processed, the non-web client can inform the user the results are available via email.

[How To Ask Questions On JavaRanch]
Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
But in case where execution of the code in the EJB (Which created and started the therad)makes sense only when the thread has done its job , which mechanism shall i follow implement such scenario because i have to wait either for the response of the thread or in case i don't get the response i have to wait for a fixed time duration.Thats why i was using join(120000) in the EJB code.

Hope i am able to elaborate the case.

please give some inputs


I agree. Here's the link:
subject: Problem in Join() with user threads in weblogic
It's not a secret anymore!