Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.1
-
None
-
None
-
Operating System: other
Platform: Other
-
26062
Description
the javadoc for BasicDataSource.html#getLoginTimeout() doesn't say anything.
Only when trying to run it, I get java.lang.UnsupportedOperationException
at
org.apache.commons.dbcp.PoolingDataSource.getLoginTimeout(PoolingDataSource.java:179)
at
org.apache.commons.dbcp.BasicDataSource.getLoginTimeout(BasicDataSource.java:542)
...
Suggestion:
- add some hint what to do when throwing UnsupportedOperationException() e.g.
"Do this configuration within my {@link ObjectPool}." as per the source in
http://cvs.apache.org/viewcvs.cgi/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/PoolingDataSource.java?rev=1.11&view=markup - make the hint more clear (I looked at
http://cvs.apache.org/viewcvs.cgi/jakarta-commons/pool/src/java/org/apache/commons/pool/ObjectPool.java?rev=1.10&view=markup
and wasn't able to pick up the trace ... nor did I find the word "timeout" in
BaseObjectPool.java or PoolableObjectFactory.java)
Background:
I am trying to gracefully do a "mysqlhotcopy" backup as per
http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Backup
and
http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#mysqlhotcopy
They lock tables for this and if accessed by another JDBC thread then, their
JDBC just hangs.
I would rather have it gracefully timeout after say 30 seconds since a backup
may last several minutes depending upon the database size and I don't want my
web-users to be frustrated this way.
Therefore, I got to look into the login timeout. If there are better practices
to handle this situation, it would be great to document this ! (e.g. also in
http://bugs.mysql.com/bug.php?id=2264)