Need Code to create Connection Pool in java

后端 未结 10 1693
轻奢々
轻奢々 2020-11-30 20:50

Need code to create the connection pool in java? How does we make sure that connection pool doesn\'t return the same object which is already in use? How happens if client cl

10条回答
  •  旧时难觅i
    2020-11-30 21:14

    Just use Semaphores. Ideally what you should do is use CP3O or DBCP as your connection pool. Now you can throttle you connection based on Semaphore.

    Every time you do Get, you acquire and on every Release you release it from Semaphore. More over semaphores are thread safe.

提交回复
热议问题