On Thu, 5 Oct 2000, Tiana Zhang wrote:

> Hello, Guys
>
> Here is the synchronized method in my servlet. I think I found out
> the problem.  It didn't have static keyword the first time, that's
> why it didn't behave the way I wanted.

As I (and others) have tried to tell you, using static is likely
unrelated to the real problem.  If you're using a recent servlet
engine/container, it will not be creating multiple instances of a
servlet, so whether something is static or not shouldn't make a
difference.  There has to be something else going on here.  And using
static is likely not the best solution.  I suggest you learn more
about synchronized, in particular, how you must synchronize on some
particular object.


> public static synchronized String assignNum(String name, String uID, String
> requestType, String comment){
>
>     String rID = "";
>     try{
>         rID = db.DBinsert(name, uID, requestType, comment);
>         db.updateSeqNum(requestType);
>
>     } catch (Exception e) {
>         System.err.println(e.toString());
>     }
>     return rID;
> }
>
> Tiana
>
> ___________________________________________________________________________
> 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
>

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