  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | | | -none- | -none- 2005-04-12 - By -not available-
Back 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 listserv@(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
|
|
 |