Web Service Thread Safety

With a servlet multiple threads can access the service() method of a servlet, so you shouldn't read/write field level variables in a servlet object.

What are the threading assumptions with a web service object? Is it 1 thread per client request? Can I safely declare field-level resources in the Object with web service methods, such as PersistenceContext, UserTransaction, DataSource, etc? Thanks for your reply.

[428 byte] By [bryan4587a] at [2007-11-26 18:28:50]
# 1

You can define what scope a web service has during deployment. For example, with the Apache Axis engine, you can declare a service as application, session, or request scope. This determines whether an invocation of a web service uses the same instance all the time, a new instance for every session, or a new instance for each web service call respectively.

MrButtheada at 2007-7-9 6:02:58 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...