This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic