This can apparently be done in Weblogic, at least(though the SPEC says not
to).
Maybe a better way is to farm your helper class out into a startup class,
from there
because it runs outside of the context of the EJB server thread control is
allowed.
I've done a threaded startup class in WL 4.5.1 and it works fine, though for
ease
of access it is probably better to make the started up class a singleton (if
you can).
Brian.
> -----Original Message-----
> From: Shyam Sankar S. [SMTP:[EMAIL PROTECTED]]
> Sent: 09 August 2000 04:51
> To: [EMAIL PROTECTED]
> Subject: Threads - the problem area
>
> 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".
===========================================================================
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".