Mark,
I had not really paid attention in the synchronized statement, I use only the method
service, I placed the
synchronized keyword and it worked.
Thank you for the explanation.
Regards,
Marcelo Bellezo
Mark Phelps wrote:
> We would need to know a lot more about your servlet to answer your question.
> Can you show us code?
>
> Some general rules to remember:
> (Forgive me if I state the obvious. I don't know if you are new to servlets
> and Java or not.)
>
> 1. Member variables, (variables defined in the class block outside of all
> methods), will be shared and visible to all requests that hit an instance of
> your servlet. In other words, all requests going to the same server and
> same JVM will share the same instances of the member variables in your
> servlet.
> 2. Access to member variables may need to be synchronized, (see the
> "synchronized" keyword), so that one thread does not trample on values
> stored by another.
> 3. Local variables, (variables defined anywhere in a method), are not
> shared between threads. Each request to the servlet will result in new
> thread-specific values.
>
> As long as you are aware of these rules you should be able to easily write
> servlets that are thread-safe, (i.e. they handle concurrent access by
> multiple users).
>
> Are you sure that it is the second user who is seeing null values? Perhaps
> it is the first user and he/she is seeing information that your servlet has
> not yet initialized.
>
> -----Original Message-----
> From: Marcelo Bellezo [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 27, 2001 8:16 AM
> To: JRun-Talk
> Subject: Error accessing one servlet at same time
>
> Hello,
>
> when two people are accessing the same servlet at same time, the one
> that got the servlet first, receives all the values ok, but the second
> receives null values.
>
> Anyone ?
>
> Marcelo Bellezo
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists