When do you check connections in the connection pool?

I am implementing a connection pool in Java (i.e. java.sql.Connections pool ). When should I check that the connections are still valid? I do not want to do this before lending them. Should I do this when they return? Everytime? Is there a way to schedule an audit?

+3
source share
5 answers

I think the answer to your question depends on how much effort you want to put into the connection pool.

An easy way would be to do what you do not want to do to check the connection when it is being requested, I expect because you do not want to delay the requesting stream when creating a new connection.

, . , , , , .

, , , Jakarta DBCP C3P0

+3

, , X , , (), , " 1 " . .

+1

, ? , 2 -

  • , (.. , , ).

, - , ( ), .

, , , - 1) . 2) .

- (, ). , (.. ).

- , .

, , , .

0

, , , .

, , .

0

"". , , , , , .

, , , . , , , , - .

, .

, . . , , , , , 2 . (, 3 ) , , .

I would suggest, however, that each individual case dictates the decision as required.

0
source

Source: https://habr.com/ru/post/1712774/


All Articles