  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | 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 | | JSP - A mailing list about Java Server Pages specification and reference | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Singleton class issue | Singleton class issue 2004-11-17 - By bin cai
Back Hello, I am developing web application based on j2ee technology:jsp, java bean and jdbc. I ceated a singleton class called "JdbcController.java" that takes the responsibility to establishing connection to DB and works fine. But my concern is :since this is multi-thread application. every thread will invoke JDBCController class . i am wondering if this will result in concurrent issue becase every thread will compete to use this class to get connection to DB. one alternative is :i don't use singleton pattern. when every thread needs to get access to DB, it will ceate new instance of JDBCControoler object. but it will use lot of memory although JVM has garbage collection mechanism. So which way is better according to you guys' experience. Please let me know. Thanks bill
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
<DIV>Hello,</DIV> <DIV>I am developing web application based on j2ee technology:jsp, java bean and jdbc.</DIV> <DIV>I ceated a singleton class called "JdbcController.java" that takes the responsibility to establishing connection to DB and works fine . But my concern is :since this is multi-thread application. every thread will invoke JDBCController class . i am wondering if this will result in concurrent issue becase every thread will compete to use this class to get connection to DB.</DIV> <DIV>one alternative is :i don't use singleton pattern. when every thread needs to get access to DB, it will ceate new instance of JDBCControoler  ;object. but it will use lot of memory although JVM has garbage collection mechanism.</DIV> <DIV>So which way is better according to you guys' experience. Please let me know.</DIV> <DIV>Thanks</DIV> <DIV>bill </DIV><p>__ ____ ____ ____ ____ ____ ____ ____ ____ ______ _<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around <br>http://mail.yahoo.com =========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help". <p>
|
|
 |