Thanks Mark.
Regs,
Mahesh Devendran
-----Original Message-----
From: Mark Galbreath [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 24, 2001 1:58 AM
To: [EMAIL PROTECTED]
Subject: Re: ThreadSafe
Implement the SingleThreadModel interface (generally not a good solution) or
learn how to program in a multithreaded environment. This is not a subject
that can be answered in a couple of sentences (and, indeed, we just had a
thread (pun intended) on this interest group on threads - check the
archives.
Generally speaking (always dangerous), a thread-safe servlet is the result
of thoughtful reflection on the part of the programmer to realize that a
method or instance variable is going to be used by different requests
simultaneously. If that may occur, you must synchronize your method or
(preferably in a servlet) the variable in a synchronization code block.
Jason Hunter demonstrates this technique in the first 3 chapters of "Java
Servlet Programming" - 1st or 2d ed.). Nevertheless, you should read some
literature on programming with threads in Java - the java.sun.com website
has a great tutorial on it, but I don't know where it is right off hand.
I will say that multithreaded programming is an art, but with Java, it
involves watercolors; with C++ it involves oils.
Cheers!
Mark
----- Original Message -----
From: "Mahesh Davendran" <[EMAIL PROTECTED]>
Sent: Monday, April 23, 2001 7:33 AM
> Hi!
> could someone there give me an example on threadsafe servlets. Thanks.
>
> Regs,
> Mahesh Devendran
___________________________________________________________________________
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
**********************************************************************
This message is a private and confidential communication
and is intended solely for the use of the individual/s and/or
group/s to which it is addressed. Any use (including
retransmission, printing or copying) of this message in whole
or in part by any person(s) and/or group(s) other than the
intended recipient(s) is strictly prohibited. If you are not an
intended recipient of this message please notify the sender
immediately and delete this message from your system.
Thank you.
**********************************************************************
___________________________________________________________________________
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