I forgot to put in the code that the int nm is returned from the ReceiveMail
method.

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 nm;
}
}

___________________________________________________________________________
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