On Tue, 6 Jul 1999, Nitin Mangtani wrote:

> yah you are right if there are no instance variables and all are
> local variables then you need not worry about synchronization
> issues.

I don't want to get into this too deeply, because it is not all that
simple and it has been discussed here before (try checking the
archives), but basically I don't think things are as simple as the
above suggests.  Avoiding class/instance variables and sticking with
local variables will help you avoid synchronization issues regarding
those variables.  However, there may be other synchronization issues
to worry about, like say with some shared resource.  For example, if
the servlet manipulates a file (e.g. writing to it), there's a
potential synchronization issue there.


> Jeetandra Mahtani wrote:
>
> > Hello,
> > Can someone please confirm the following and maybe provide some
> > insight to make my concepts thorough.  If there are no instance
> > variables and only local variables, one does not need to worry
> > about different threads accessing the same variable, right?  If
> > only local variables are being used in all classes, does one need
> > to worry about synchronization/thread issues?  When does one need
> > to use the SingleThread Model ?
>
> Normally one does not use SingleThread Model because if restricts
> the usage to only one client at a given time. But if you have some
> critical resource which has to be shared across multiple clients and
> you want only one client can acces it then you go for it.

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