Hi everyone,

In the midst of design, we are confronted with a problem. The scenario is
this:

I have got a session bean called a worker bean which processes requests.
Now our customer has got a new requirement that all the requests should be
processed concurrently. From the EJB spec, I inferred that threads are not
possible. But am I allowed to use threads in the helper class?

Is it possible for me to write a code like this:

public class WorkerSessionBean implements SessionBean{

              public void work(int noofprocess){
                          Helper helper = new Helper();
                          helper.doWork(noofprocess);
              }
 }

class Helper{
              public void doWork(int noofprocess){
                            MyThread[] myThreads = new MyThread[noofprocess
];
                            for (int i=0; i<noofprocess; i++){
                                 myThreads[i] = new MyThread();
                             }

                             for (int i=0; i<times; i++){
                                               myThreads[i].start();
                             }
              }
 }

 class MyThread extends Thread{
               public void run(){
                              //  process
                }
 }

The SessionBean's client will know the number of requests to be processed
and supply that as the argument to work().

It would be very helpful if you could share your valuable opinions about
this and suggest a problem.

Thanks in advance,

Shyam Sankar S.
Software Engineer,
IBS Software Services,
NILA, Technopark,
Trivandrum - 695 581
INDIA

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to