Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

threading in JSE

 
Jack Zhou
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a JSE servlet is deployed as multple threading, what are the impacts on the service endpoint class?
I understand that it is the servlet that unmarshals the soap messages and interprets it into the appropriate ws calls. But the instance of the endpoint class, which I mean the class implementing the ws method, could be created every time a client send a request. In this case, single threading or not, there will be no difference on the service endpoint class as far as the thread safe is concerned.
Am I right?
 
Richard Monson-Haefel
author
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the way that vendors will implement JSEs (ok, the most likely way). They will generate a JAX-RPC Servlet that maintains a *single* reference to an instance of the endpoint class for its entire lifecycle. That instance will be accessed, if the Servlet is multi-threaded (seems likely), by any number of threads at the same time.
Please do not treat the endpoint as a single threaded object - it will most certainly be accessed by multiple threads concurrently. Just as with Servlets you must mind this fact when using instance variables.
I hope this helps,
Richard
 
Jack Zhou
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rechard,
Certainly I should not assume that THE servlet will create the endpoint every time a request comes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic