Then, since you are not using any instance variables in your example, I'd
have to say the example given is thread safe. You'll probably have to look
elsewhere for the cause of the problems.
(*Chris*)
----- Original Message -----
From: Duke Martin <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 27, 1999 11:11 AM
Subject: Re: problem with multiple users changing variables???
> Sorry. The code should read "return nm;" It was a typo
>
> Duke
>
> ----- Original Message -----
> From: Chris Pratt <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 27, 1999 11:42 AM
> Subject: Re: problem with multiple users changing variables???
>
>
> > In order to return the value from ReceiveMail, you must use "return
nm;",
> > not simply "return:". I assume this is just a typo in your mail, but
> > SingleThreadModel is one word.
> > (*Chris*)
> >
> > ----- Original Message -----
> > From: Duke Martin <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, September 26, 1999 10:03 AM
> > Subject: problem with multiple users changing variables???
> >
> >
> > > Hi,
> > >
> > > I am having a problem with my servlet that checks the inbox on an imap
> > > server. I did not have any problems until many users began using the
> > > servlet. What is happening is that sometimes new messages will be in
> the
> > > inbox but the "new mail notification" doesn't occur. I think it has
to
> do
> > > with the int nm. Maybe one user has set it to be equal to zero and at
> the
> > > same time another user is seeing this value of the variable and
> therefore
> > > not seeing the "You have new messages" notification. Please look at
the
> > > following segment of code and see if you see any problems with
multiple
> > > users accessing my servlet.
> > >
> > > public clas MyServlet extends HttpServlet implements Single Thread
Model
> > > {
> > > public void doGet(HttpServletRequest req, HttpServletResponse
> > > res) throws ServletException, IOException
> > > {
> > > .
> > > .
> > > .
> > > int new_messages = ReceiveMail();
> > > if ( new_messages == 0 )
> > > out.println("There are no new messages");
> > > if ( new_messages == 1 )
> > > out.println("You have new messages");
> > > }
> > > public synchronized int ReceiveMail()
> > > {
> > > int nm = 0;
> > > .
> > > .
> > > ...JavaMail Code to receive mail, if there are new messages in the
> > > inbox, nm =1, esle nm = 0
> > > return;
> > > }
> > > }
> > >
> > >
> >
>
___________________________________________________________________________
> > > 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
> > >
> >
> >
>
___________________________________________________________________________
> > 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
>
>
___________________________________________________________________________
> 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
___________________________________________________________________________
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