• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Neil: Specification and Struts

 
Pravin Panicker
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
 
Anupreet Arora
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
 
Neal Ford
Author
Ranch Hand
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic