• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is mutithread permitted in ejb?

 
Clark Lee
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,guys
It's said in ejb spec that The enterprise bean must not attempt to manage threads(ejb-spec page495).But can anyone explain me wether a stateless session bean can call a class that manage threads? In other words,is it permitted that thread api(ex: thread.start()) appear in ejb application?

Thanks.
 
MadhuRam
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it is not allowed. Even if its a different class that session bean calls to its executing in the container context and thread management is no.

An I correct?
 
Barend Garvelink
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Starting your own threads basically goes against the managed environment you're working in (i.e. you're bypassing the application server). It gets messy really quickly.

If you want to fire off a thread whilst handling some client request, I assume that is for doing some (batch) processing that takes too long to complete to just keep the client request open. Without knowing the actual context and problem domain you're working in, I'd say put the relevant data on a local queue and let an MDB do the processing.
 
Clark Lee
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answers.Just like Barend's description,Our job is batch processing and the codes running used muti thread. I am not agree with this way too,but I can't tell the reason. Can anyone list the disadvantage in detail for me?

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic