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?
java.sql.Connection
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
, , X , , (), , " 1 " . .
, ? , 2 -
, - , ( ), .
, , , - 1) . 2) .
- (, ). , (.. ).
- , .
, , , .
, , .
"". , , , , , .
, , , . , , , , - .
, .
, . . , , , , , 2 . (, 3 ) , , .
I would suggest, however, that each individual case dictates the decision as required.
Source: https://habr.com/ru/post/1712774/More articles:Java synchronization and threads - javaWhy are my validation rules not executed when setting the DataContext? - c #Is it possible and / or expedient to dynamically generate tests in rails? - ruby-on-railsPython ctype for using libc.so.6 Linux and libc.dylib Mac OS X - pythonCan I display Direct3D graphics over tcp / ip or another network protocol? - cluster-computingEsper and SQS - cloudSending email with MS Access. Third Party Permission Allowed. - vbaHow to create parameterized XPath queries on SQL server? - securityRecover Deleted Problem in Mantis? - mantisWeb Services in classic asp - web-servicesAll Articles