Java MySQL JDBC Memory Leak

前端 未结 4 1600
死守一世寂寞
死守一世寂寞 2020-12-08 23:13

Ok, so I have this program with many (~300) threads, each of which communicates with a central database. I create a global connection to the DB, and then each thread goes ab

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 23:36

    Without seeing your code (which I'm sure is massive), you should really consider some sort of more formal thread pooling mechanism, such as Apache Commons pool framework, Spring's JDBC framework, and others. IMHO, this is a much simpler approach, since someone else has already figured out how to effectively manage these types of situations.

提交回复
热议问题