I thought a singleton was not threadsafe by default, such as a Java Servlet? I did a more thorough reading of the CXF docs and saw the Spring configured Resource classes are Singletons and not Prototype Beans. So in other words, each request will share the same instance of my AccountService Resource class. If i have a member variable: private Account account, this will be shared by all requests and get overwritten by each request. Right?
On Fri, Aug 21, 2009 at 6:19 AM, Sergey Beryozkin <[email protected]>wrote: > Hi > > ----- Original Message ----- From: "Nathaniel Auvil" < > [email protected]> > To: <[email protected]> > Sent: Thursday, August 20, 2009 6:18 PM > Subject: Thread Safety > > > > I am implementing JAX-RS web service with CXF and i want to confirm my >> Resource classes are thread safe. i am thinking they are as the examples >> show member variables holding various contexts and the like and no where >> down the chain does the "AbstractService" extend java servlet. Can >> someone >> in the know please confirm? >> >> > All the fields containing injected contexts are thread safe, when resource > classes are singletons, so yes resource classes are thread safe. > > and no where down the chain does the "AbstractService" extend java >> servlet. >> > > Can you clarify please what you meant to say ? > > thanks, Sergey >
