Mulitple threads call Session Beas
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Manju_k
Posted On:   Monday, December 16, 2002 10:39 PM

Scenario: I have a file processing component that reads the file and spawns the thread for each set of records(say thread for every 5 records). The threads, so spawned by the file processing, make call to Session Bean. ...Threads.... FileProcessing()-->ThreadforRecord()------> SessionBean() -------->ThreadforRecord()-----------> SessionBean() -------->ThreadforRecord()-----------> SessionBean() FileProcessing should delete after all the threads complete their processing What do we do for fail over of the ThreadforRecord? i.e if the thread fails before the Session bean competes the transaction? How to keep track of the thread's status?    More>>

Scenario:
I have a file processing component that reads the file and spawns the thread for each set of records(say thread for every 5 records). The threads, so spawned by the file processing, make call to Session Bean.

...Threads....

FileProcessing()-->ThreadforRecord()------> SessionBean()
-------->ThreadforRecord()-----------> SessionBean()
-------->ThreadforRecord()-----------> SessionBean()


FileProcessing should delete after all the threads complete their processing

What do we do for fail over of the ThreadforRecord? i.e if the thread fails before the Session bean competes the transaction?
How to keep track of the thread's status?

   <<Less

Re: Mulitple threads call Session Beas

Posted By:   Alex_Chaffee  
Posted On:   Saturday, December 28, 2002 10:44 AM

If the thread calls the session bean, then a failure in the session bean will generate an exception, which can be caught in the normal way (with a catch block).


If the session bean spawns a thread, then that's a violation of the EJB contract, and you need to figure out another way to do things, e.g. Message Beans.


As for how to "keep track", search the Threads FAQ for basic programming information about how to share data between threads.

About | Sitemap | Contact