• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJb and incoming requests

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I know that EJB is using the multithreading feature to manage EJB sessions and manage the lifecycle.. That is well understood. What I need to know:

which thread is used to fetch records from the database? If EJB thread is the answer, then what the jsp thread will be doing at this time? waiting/sleeping ?

In Other words, when an incoming request (including rmi) is initiated, which container's thread is executing the code in the ejb session (including the datastore fetch/update or delete).. Thanks!
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It probably depends on the implementation of the server. Your code should not make any assumptions.

In WebSphere if the WAR and EJBs are deployed in the same server, then the JSP thread will call directly into the EJB container and it will run the EJB code there. However, if the WAR is deployed in a separate server (e.g. in the web tier) then of course the JSP's thread cannot be used (it does not exist in the EJB server). In that case the EJB is run with a container thread and the JSP thread is blocked (waiting) in the RMI call.

Other vendors (e.g. WebLogic) may behave differently when both containers are in the same JVM. When they are separate JVMs, the same thread cannot be used no matter the vendor.
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic