On Fri, 5 Nov 1999, Emuleomo, Olu (PME) wrote:

>>>>>
>The above answers assume that none of the local variables are
>references to finite resources like DB Connections that can be shared
>of course.
>>>>>
>
> Even if a local variable refers to a db resource etc, it is *still*
> threadsafe, because each servlet thread will refer to different
> instances of the resource....unless of course, if the resource is a
> singleton.

I don't think this is correct.  What if a local variable is set to a
File which is read from and written to?  That wouldn't be thread-safe.
(In that sense, a file is similar to a singleton.)


> > -----Original Message-----
> > From: Andy Bailey [SMTP:[EMAIL PROTECTED]]
> > Sent: Friday, November 05, 1999 7:42 AM
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: Is this correct ?
> >
> > > Hi everyone
> > >
> > > Could you give a yes or no on the querys below please if possible:
> > >
> > > 1. A thread enters doGet, the local variables are thread safe?
> > Local to the method, yes.
> >
> > > 2. A thread in doGet calls a method passing local variables, still
> > > thread safe ?
> >
> > Yes.
> >
> > > 3. The method called above has local variables which are used in
> > > processing the above, still safe ?
> >
> > Yes.
> >
> > > 4. The method returns a result and the doGet continues through methods
> > > similar to above before outputting a result. As I understand it this
> > > should be thread safe and I do not have to concern myself with
> > > concurrency problems, is this correct?
> >
> > Yes, if the returned var is stored in a var local to the calling method
> >
> > > 5. Only instance variables need 'protecting' against concurrency
> > > problems, yes or no ?
> > Only if they are read from and written to.
> >
> > The above answers assume that none of the local variables are references
> > to
> > finite resources
> > like DB Connections that can be shared of course.
> >
> > Andy Bailey
> >
>

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to