You have misunderstood synchronization and threads.

You don't need to synchronize access to a bean created in a thread:


>From SimpleCtl1.java:
        switch (nAction)
        {
                case 0:
                        SimpleBean1 sb = new SimpleBean1() ;

                        synchronized(sb)
                        {
                                sb.getUserRecord(request, lUserID) ;
                                session.setAttribute("sb",sb) ;
                        }


synchronizing access to sb is not necessary because you're creating it
in the stack of a thread (you only need synchronization when you sync
*between* threads).


You're not closing the SQL connection in the method getUserRecord() in
SimpleBean1.java.

This could cause strange things to happen.


The problem is that you are doing many requests simultaneously but not
controlling access to your resources properly.

In other words the ConnectionBean is useless. You're getUserRecord()
method should:

- create a connection
- do the SQL query
- create the bean from the data
- close the query
- close the connection

I you do that you will find your problem goes away.


You should also take out the spurious sync on the bean in the doPost.


Nic Ferrier
http://www.tapsellferrier.co.uk

___________________________________________________________________________
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