users@glassfish.java.net

WebService objects vs. Worker Threads

From: <glassfish_at_javadesktop.org>
Date: Wed, 28 May 2008 06:34:11 PDT

I recently had a race condition occur in my Sun Java Application Server application. I finally figured out that the problem was that the app server created 3 instances of my Web Service class, but was calling those 3 instances with 5 threads. My Web Service class had global (not static) variables because I expected that a specific object would only be used by a single thread at a time. So my question is: is this a flaw in my logic and a web service object should expect to be called from multiple threads, or is this a bug in the application server. It doesn't make sense to me that the app server would create 3 instances and call them with 5 threads. It seems like the app server would create 1 object/thread or just 1 object.
[Message sent by forum member 'ethere0683' (ethere0683)]

http://forums.java.net/jive/thread.jspa?messageID=276995