http://www.ibm.com/developerworks/java/library/j-threads3.html
For example, the JDBC Connection class is not thread-safe -- two threads cannot safely share a Connection at a fine level of granularity -- but if each thread had its own Connection, then multiple threads can safely perform database operations simultaneously.
JDBC의 Connection 클래스는 thread-safe 하지 않다고 한다.
그래서 각 쓰레드마다 커넥션을 소유하면 된다고 되어 있다.
밑에는 TLS 에 대한 이야기이고..
아니면 DAO를 singleton 으로 만들고
DAO에서 커넥션을 1개만 사용하면서 모든 메소드에 적절히 lock을 걸어도 될듯.
'Java' 카테고리의 다른 글
email 보내기 (0) | 2011.11.26 |
---|---|
floating point bug (0) | 2011.11.26 |
Exception, RuntimeException (0) | 2011.11.26 |
bitmap class 구현 (0) | 2011.11.26 |
MD5 구현(C++, Java, Js) (0) | 2011.11.26 |