• 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

JAX WS multiple requests management

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I'm starting studying java web services with JAX WS. The first chapter of the book I'm reading shows how to build and publish a simple jax ws web service using only java SE. In particular, the web service is published through the Endpoint class. After publishing the web service, the author specifies that

"Out of the box, the Endpoint publisher handles one client request at a time ... if the processing of a given request should hang, then all other client requests are effectively blocked. An example at the end of this chapter shows how Endpoint can handle requests concurrently so that one hung request does not block the others."

To see this, I tried to send two requests to a web service with 2 threads. Here is the code:



If I start MyClient class, the thread called "miao" sends its request and then goes to sleep. However, the thread called "bau" does not wait for the previous request and its request is immediately satisfied.

I get the same result if I call the WS with SoapUI using 2 different request instances.

Am I missing something? Can java threads be used to simulate multiple requests?

Thanks a lot for your help,
Nico
 
Nico Rossi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I downloaded jax-ws 2.0 specification and it disproves what the book I'm reading says:

"An endpoint consists of an object that acts as the Web service implementation (called here implementor) plus some configuration information ... An Endpoint will be typically invoked to serve concurrent requests, so its implementor should be written so as to support multiple threads. The synchronized keyword may be used as usual to control access to critical sections of code. For finer control over the threads used to dispatch incoming requests, an application can directly set the executor to be used"

(http://jcp.org/aboutJava/communityprocess/final/jsr224/index.html, section 5.2.2 "Publishing", page 67)

The book speaks about jax-ws 2.1 but I didn't manage to download that version of the specification. Anyway, jax-ws 2.2 specification (current version) confirms the concurrent nature of the Endpoint class (it contains the same sentences as above).

I don't know what the author of the book means exactly.
 
reply
    Bookmark Topic Watch Topic
  • New Topic