concurrency and web-services

U

Uli

Hello!

Does anybody know if there is a way to make a web-service concurrent?
So that several clients can call at the same time a web-service. Is
there a mechanism or a framework to enable this, or does one have to
create a new thread each time the web-service is called?

Uli
 
G

Gerbrand van Dieijen

Hello!

Does anybody know if there is a way to make a web-service concurrent?
So that several clients can call at the same time a web-service. Is
there a mechanism or a framework to enable this, or does one have to
create a new thread each time the web-service is called?

I do not have much experience with webservices, but some in
distributed object system. Making threads for each call/client
is most likely allready done using the webservices-server (tomcat
or whatever), I don't think you would have to deal with that.

Furthermore, in Tomcat, webservices can have three types for livetime:
application, session and request, with application an instances object
keeps alive all the time and is used for all other request, with
session only for the current user, etc.

To make program work well with multiple threads accessing it at the
same time (not a problem if a new object is created for every session
or request), you can use the synchronized statement of java.
If you put synchronized before a method, when the method is called
no (other) method of the object can be called at the same time.
This way you can avoid problems that can occur when to methods
try to change the same object or variable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top