Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Neil: Specification and Struts

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Neil,
Sun's servlet specifications states that it is best avoided to pass the request, response
to another thread of execution.. as they are not gauranteed to be thread safe.
to quote..
"
2.3.3.3
A Developer should note that implementations of the request and response objects are not
guaranteed to be thread safe. This means that they should only be used in the scope of the
request handling thread. References to the request and response objects should not be given
to objects executing in other threads as the behavior may be nondeterministic.
"
Is the Action Servlets behaviour to pass the request, response to the Action class any cause of concern.
Please shed more light on this in the context of the specification
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting question..
But I think that though an ActionServlet passes the request and reponse objects to an Action class, it does not start a new or a separate thread for it. The ActionServlet itself might be executing in a separate thread for a fresh request, as is true with all servlets, but it does not spawn any new threads when it delegates to the Action classes.
Rgds,
Anupreet Arora
 
Pravin Panicker
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okk Thanks.. I guess the behaviour of Action Servlet's service would be

void service(){
1. Load the action class from config
2. Pass the parameters and call its action method
}

So it all happens in the same thread There is a containment relationship between the Action Servlet and the Actionclass
guess i was plain confused.. Thanks a lot
 
Author
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, this is correct -- the Action is invoked in the thread spawned for the user from the ActionServlet.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic