Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mysql/mysql-connector-j
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.1.28
Choose a base ref
...
head repository: mysql/mysql-connector-j
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5.1.29
Choose a head ref
  • 10 commits
  • 100 files changed
  • 3 contributors

Commits on Nov 25, 2013

  1. Post-release changes.

    soklakov committed Nov 25, 2013
    Copy the full SHA
    c114af4 View commit details

Commits on Dec 3, 2013

  1. Copy the full SHA
    0cbc4d2 View commit details
  2. Fix incorrect license headers

    Jess Balint committed Dec 3, 2013
    Copy the full SHA
    f18cba9 View commit details

Commits on Dec 4, 2013

  1. Copy the full SHA
    0fba3b9 View commit details

Commits on Dec 11, 2013

  1. Copy the full SHA
    e4d30dc View commit details
  2. Copy the full SHA
    7183b47 View commit details

Commits on Jan 17, 2014

  1. Copy the full SHA
    de43fb6 View commit details
  2. Fix for Bug#70701, DatabaseMetaData.getSQLKeywords() doesn't match My…

    …SQL 5.6 reserved words
    fjssilva committed Jan 17, 2014
    Copy the full SHA
    126fdef View commit details

Commits on Jan 20, 2014

  1. Copy the full SHA
    81cfae1 View commit details
  2. New version, 5.1.29

    soklakov committed Jan 20, 2014
    Copy the full SHA
    952a454 View commit details
Showing with 20,238 additions and 23,165 deletions.
  1. +1 −3 .classpath
  2. +14 −0 CHANGES
  3. +20 −16 build.xml
  4. +76 −76 src/com/mysql/jdbc/BalanceStrategy.java
  5. +119 −119 src/com/mysql/jdbc/BestResponseTimeBalanceStrategy.java
  6. +764 −765 src/com/mysql/jdbc/BufferRow.java
  7. +295 −296 src/com/mysql/jdbc/ByteArrayRow.java
  8. +55 −56 src/com/mysql/jdbc/CachedResultSetMetaData.java
  9. +250 −250 src/com/mysql/jdbc/ConnectionGroup.java
  10. +214 −214 src/com/mysql/jdbc/ConnectionGroupManager.java
  11. +48 −31 src/com/mysql/jdbc/ConnectionImpl.java
  12. +127 −128 src/com/mysql/jdbc/ConnectionLifecycleInterceptor.java
  13. +4 −0 src/com/mysql/jdbc/ConnectionProperties.java
  14. +13 −0 src/com/mysql/jdbc/ConnectionPropertiesImpl.java
  15. +114 −136 src/com/mysql/jdbc/DatabaseMetaData.java
  16. +1,828 −1,827 src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java
  17. +56 −57 src/com/mysql/jdbc/Extension.java
  18. +74 −75 src/com/mysql/jdbc/IterateBlock.java
  19. +283 −284 src/com/mysql/jdbc/JDBC4CallableStatement.java
  20. +137 −138 src/com/mysql/jdbc/JDBC4ClientInfoProvider.java
  21. +167 −168 src/com/mysql/jdbc/JDBC4ClientInfoProviderSP.java
  22. +106 −107 src/com/mysql/jdbc/JDBC4CommentClientInfoProvider.java
  23. +240 −241 src/com/mysql/jdbc/JDBC4Connection.java
  24. +174 −173 src/com/mysql/jdbc/JDBC4DatabaseMetaData.java
  25. +179 −178 src/com/mysql/jdbc/JDBC4DatabaseMetaDataUsingInfoSchema.java
  26. +135 −138 src/com/mysql/jdbc/JDBC4LoadBalancedMySQLConnection.java
  27. +70 −73 src/com/mysql/jdbc/JDBC4MySQLConnection.java
  28. +836 −837 src/com/mysql/jdbc/JDBC4MysqlSQLXML.java
  29. +44 −45 src/com/mysql/jdbc/JDBC4NClob.java
  30. +78 −79 src/com/mysql/jdbc/JDBC4PreparedStatement.java
  31. +99 −77 src/com/mysql/jdbc/JDBC4PreparedStatementHelper.java
  32. +544 −545 src/com/mysql/jdbc/JDBC4ResultSet.java
  33. +151 −152 src/com/mysql/jdbc/JDBC4ServerPreparedStatement.java
  34. +613 −614 src/com/mysql/jdbc/JDBC4UpdatableResultSet.java
  35. +46 −46 src/com/mysql/jdbc/LoadBalanceExceptionChecker.java
  36. +139 −140 src/com/mysql/jdbc/LoadBalancedAutoCommitInterceptor.java
  37. +2,656 −2,648 src/com/mysql/jdbc/LoadBalancedMySQLConnection.java
  38. +1,145 −1,145 src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
  39. +1 −0 src/com/mysql/jdbc/LocalizedErrorMessages.properties
  40. +40 −18 src/com/mysql/jdbc/NdbLoadBalanceExceptionChecker.java
  41. +19 −15 src/com/mysql/jdbc/NoSubInterceptorWrapper.java
  42. +94 −95 src/com/mysql/jdbc/ParameterBindings.java
  43. +30 −30 src/com/mysql/jdbc/PingTarget.java
  44. +130 −131 src/com/mysql/jdbc/RandomBalanceStrategy.java
  45. +19 −15 src/com/mysql/jdbc/ReflectiveStatementInterceptorAdapter.java
  46. +8 −0 src/com/mysql/jdbc/ReplicationConnection.java
  47. +169 −170 src/com/mysql/jdbc/ResultSetInternalMethods.java
  48. +1,483 −1,484 src/com/mysql/jdbc/ResultSetRow.java
  49. +166 −167 src/com/mysql/jdbc/SequentialBalanceStrategy.java
  50. +122 −122 src/com/mysql/jdbc/StandardLoadBalanceExceptionChecker.java
  51. +142 −143 src/com/mysql/jdbc/StatementInterceptor.java
  52. +19 −15 src/com/mysql/jdbc/StatementInterceptorV2.java
  53. +28 −29 src/com/mysql/jdbc/StreamingNotifiable.java
  54. +21 −17 src/com/mysql/jdbc/V1toV2StatementInterceptorAdapter.java
  55. +5 −5 src/com/mysql/jdbc/configs/5-0-Compat.properties
  56. +25 −25 src/com/mysql/jdbc/configs/coldFusion.properties
  57. +45 −46 src/com/mysql/jdbc/exceptions/MySQLStatementCancelledException.java
  58. +85 −88 src/com/mysql/jdbc/exceptions/jdbc4/CommunicationsException.java
  59. +44 −45 src/com/mysql/jdbc/exceptions/jdbc4/MySQLQueryInterruptedException.java
  60. +111 −112 src/com/mysql/jdbc/interceptors/ResultSetScannerInterceptor.java
  61. +106 −107 src/com/mysql/jdbc/interceptors/ServerStatusDiffInterceptor.java
  62. +90 −93 src/com/mysql/jdbc/interceptors/SessionAssociationInterceptor.java
  63. +8 −0 src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java
  64. +1,006 −1,009 src/com/mysql/jdbc/jdbc2/optional/JDBC4CallableStatementWrapper.java
  65. +336 −339 src/com/mysql/jdbc/jdbc2/optional/JDBC4ConnectionWrapper.java
  66. +106 −107 src/com/mysql/jdbc/jdbc2/optional/JDBC4MysqlPooledConnection.java
  67. +98 −99 src/com/mysql/jdbc/jdbc2/optional/JDBC4MysqlXAConnection.java
  68. +535 −538 src/com/mysql/jdbc/jdbc2/optional/JDBC4PreparedStatementWrapper.java
  69. +196 −199 src/com/mysql/jdbc/jdbc2/optional/JDBC4StatementWrapper.java
  70. +98 −99 src/com/mysql/jdbc/jdbc2/optional/JDBC4SuspendableXAConnection.java
  71. +65 −66 src/com/mysql/jdbc/jdbc2/optional/MysqlXAException.java
  72. +110 −111 src/com/mysql/jdbc/jdbc2/optional/MysqlXid.java
  73. +209 −212 src/com/mysql/jdbc/jdbc2/optional/SuspendableXAConnection.java
  74. +119 −119 src/com/mysql/jdbc/jmx/LoadBalanceConnectionGroupManager.java
  75. +53 −53 src/com/mysql/jdbc/jmx/LoadBalanceConnectionGroupManagerMBean.java
  76. +58 −59 src/com/mysql/jdbc/profiler/LoggingProfilerEventHandler.java
  77. +31 −32 src/com/mysql/jdbc/profiler/ProfilerEventHandler.java
  78. +0 −65 src/lib-nodist/CommercialLicenseConfiguration.notjava
  79. +0 −59 src/lib-nodist/ExportControlledNoCrypto.notjava
  80. +0 −62 src/lib-nodist/FSCONTEXT-COPYRIGHT
  81. +0 −253 src/lib-nodist/FSCONTEXT-LICENSE
  82. +0 −15 src/lib-nodist/LICENSE.mysql
  83. +0 −253 src/lib-nodist/PROVIDERUTIL-LICENSE
  84. +0 −2,226 src/lib-nodist/README-commercial
  85. BIN src/lib-nodist/ant-contrib.jar
  86. BIN src/lib-nodist/fscontext.jar
  87. +0 −125 src/lib-nodist/junit-3.8.2-LICENSE.html
  88. BIN src/lib-nodist/junit-3.8.2.jar
  89. BIN src/lib-nodist/providerutil.jar
  90. +23 −0 src/testsuite/regression/ConnectionRegressionTest.java
  91. +15 −2 src/testsuite/regression/MetaDataRegressionTest.java
  92. +499 −502 src/testsuite/regression/MicroPerformanceRegressionTest.java
  93. +39 −0 src/testsuite/regression/SyntaxRegressionTest.java
  94. +61 −62 src/testsuite/regression/jdbc4/ExceptionSubclassesTest.java
  95. +14 −1 src/testsuite/regression/jdbc4/MetaDataRegressionTest.java
  96. +143 −146 src/testsuite/simple/ReadOnlyCallableStatementTest.java
  97. +248 −245 src/testsuite/simple/ResultSetTest.java
  98. +124 −127 src/testsuite/simple/SplitDBdotNameTest.java
  99. +484 −484 src/testsuite/simple/XATest.java
  100. +644 −647 src/testsuite/simple/jdbc4/StatementsTest.java
4 changes: 1 addition & 3 deletions .classpath
Original file line number Diff line number Diff line change
@@ -6,12 +6,10 @@
<attribute name="javadoc_location" value="http://java.sun.com/j2se/1.5.0/docs/api/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="src/lib-nodist/fscontext.jar"/>
<classpathentry kind="lib" path="src/lib-nodist/providerutil.jar"/>
<classpathentry kind="lib" path="src/lib/jboss-common-jdbc-wrapper.jar"/>
<classpathentry kind="lib" path="src/lib/c3p0-0.9.1-pre6.jar"/>
<classpathentry kind="lib" path="src/lib/slf4j-api-1.6.1.jar"/>
<classpathentry kind="lib" path="src/lib-nodist/junit-3.8.2.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/MySQL ConnectorJ Extra Libraries"/>
<classpathentry kind="output" path="bin"/>
</classpath>
14 changes: 14 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog
# $Id$
02-10-14 - Version 5.1.29

- Fix for Bug#70701 (17647584), DatabaseMetaData.getSQLKeywords() doesn't match MySQL 5.6 reserved words.

- Fix for Bug#17435879, REMOVE SRC/LIB-NODIST DIRECTORY FROM LAUNCHPAD DISTRIBUTION.
Additional "com.mysql.jdbc.extra.libs" parameter must be used for ant build.

- Fix for Bug#71038, Add an option for custom collations detection.
Added new connection property detectCustomCollations=[true|false], with default false.
Please be aware that these changed the previous default behavior and if you use custom charsets or collations
you need to set detectCustomCollations=true.

- Added tests for new index renaming syntax introduced in 5.7.1.

12-23-13 - Version 5.1.28

- Fix for Bug#69579, DriverManager.setLoginTimeout not honored.
36 changes: 20 additions & 16 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0'?>
<!--
Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
@@ -30,7 +30,7 @@

<property name="major_version" value="5"/>
<property name="minor_version" value="1"/>
<property name="subminor_version" value="28"/>
<property name="subminor_version" value="29"/>
<property name="version_status" value=""/>

<property name="version" value="${major_version}.${minor_version}.${subminor_version}${version_status}"/>
@@ -85,9 +85,16 @@

<property name="com.mysql.jdbc.docs.sourceDir" value="/home/mmatthew/work/docs/prebuilt"/>

<!--
The following property allows to point the location of third-party libraries
we don't distribute. Default value points to src/lib so user could either put
these jars there or pass different location via ant -D switch.
-->
<property name="com.mysql.jdbc.extra.libs" value="${sourceDir}/lib"/>

<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${sourceDir}/lib-nodist" erroronmissingdir="false">
<fileset dir="${com.mysql.jdbc.extra.libs}" erroronmissingdir="false">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${sourceDir}/lib">
@@ -101,7 +108,7 @@
</path>

<path id="project.build.classpath">
<fileset dir="${buildDir}/${fullProdName}/lib-nodist">
<fileset dir="${com.mysql.jdbc.extra.libs}">
<include name="**/*.jar"/>
</fileset>

@@ -146,8 +153,6 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
can't dynamically alter the classpath, and not having this
directory present causes the build to fail -->

<mkdir dir="${buildDir}/${fullProdName}/lib-nodist" />

<available file="${com.mysql.jdbc.docs.sourceDir}" property="com.mysql.jdbc.docs.sourcesPresent" />

<available classname="com.mchange.v2.c3p0.QueryConnectionTester"
@@ -256,7 +261,7 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
</target>

<target name="-init-no-crypto" depends="-init-copy" if="com.mysql.jdbc.noCryptoBuild">
<copy file="${sourceDir}/lib-nodist/ExportControlledNoCrypto.notjava"
<copy file="${com.mysql.jdbc.extra.libs}/ExportControlledNoCrypto.notjava"
toFile="${buildDir}/${fullProdName}/com/mysql/jdbc/ExportControlled.java"
overwrite="true"/>
</target>
@@ -365,7 +370,6 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
<exclude name="**/*.nb*"/>
<exclude name="**/*.bak"/>
<exclude name="**/*.*~"/>
<exclude name="**/lib-nodist/*"/>
<exclude name="**/lib-coverage/*"/>
<exclude name="**/clover/*"/>
<exclude name="**/checkstyle/*"/>
@@ -387,7 +391,7 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
<if>
<isset property="com.mysql.jdbc.commercialBuild"/>
<then>
<copy file="${sourceDir}/lib-nodist/README-commercial" tofile="${packageDest}/README.txt" filtering="true">
<copy file="${com.mysql.jdbc.extra.libs}/README-commercial" tofile="${packageDest}/README.txt" filtering="true">
<filterset refid="versionFilterset" />
<filterset refid="licenseFilterset" />
</copy>
@@ -417,7 +421,7 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
<isset property="com.mysql.jdbc.commercialBuild"/>
<then>
<delete file="${packageDest}/COPYING"/>
<copy file="${sourceDir}/lib-nodist/LICENSE.mysql" toDir="${packageDest}"/>
<copy file="${com.mysql.jdbc.extra.libs}/LICENSE.mysql" toDir="${packageDest}"/>

<!-- For safety -->
<replaceregexp
@@ -593,7 +597,7 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
<sysproperty key="com.mysql.jdbc.testsuite.url" value="${com.mysql.jdbc.testsuite.url}"/>

<classpath>
<fileset dir="${sourceDir}/lib-nodist">
<fileset dir="${com.mysql.jdbc.extra.libs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${buildDir}/${fullProdName}/lib">
@@ -628,7 +632,7 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
<sysproperty key="com.mysql.jdbc.testsuite.url" value="${com.mysql.jdbc.testsuite.url}"/>

<classpath>
<fileset dir="${sourceDir}/lib-nodist">
<fileset dir="${com.mysql.jdbc.extra.libs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${buildDir}/${fullProdName}/lib">
@@ -745,7 +749,7 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd

<classpath>
<pathelement location="${buildDir}/${fullProdName}"/>
<fileset dir="${sourceDir}/lib-nodist">
<fileset dir="${com.mysql.jdbc.extra.libs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${buildDir}/${fullProdName}/lib">
@@ -1040,7 +1044,7 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
<jvmarg value="-Demma.coverage.out.merge=true" />
<sysproperty key="com.mysql.jdbc.testsuite.url" value="${com.mysql.jdbc.testsuite.url}"/>
<classpath>
<fileset dir="${sourceDir}/lib-nodist">
<fileset dir="${com.mysql.jdbc.extra.libs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${buildDir}/${fullProdName}/lib">
@@ -1092,7 +1096,7 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
<sysproperty key="com.mysql.jdbc.compliance.url" value="${com.mysql.jdbc.compliance.url}"/>
<classpath>
<pathelement location="${buildDir}/${fullProdName}"/>
<fileset dir="${sourceDir}/lib-nodist">
<fileset dir="${com.mysql.jdbc.extra.libs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${buildDir}/${fullProdName}/lib">
@@ -1153,7 +1157,7 @@ and the full path to the rt.jar from Java-6 with the property &quot;com.mysql.jd
<sysproperty key="com.mysql.jdbc.testsuite.url" value="@{jdbcUrl}" />

<classpath>
<fileset dir="${sourceDir}/lib-nodist">
<fileset dir="${com.mysql.jdbc.extra.libs}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${buildDir}/${fullProdName}/lib">
152 changes: 76 additions & 76 deletions src/com/mysql/jdbc/BalanceStrategy.java
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
/*
Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
There are special exceptions to the terms and conditions of the GPLv2 as it is applied to
this software, see the FLOSS License Exception
<http://www.mysql.com/about/legal/licensing/foss-exception.html>.
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; version 2
of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this
program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
Floor, Boston, MA 02110-1301 USA
*/
package com.mysql.jdbc;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
* Implement this interface to provide a new load balancing strategy for URLs of
* the form "jdbc:mysql:loadbalance://..", and provide the implementation class
* name as the configuration parameter "loadBalanceStrategy".
*
* The driver will not pass in a Connection instance when calling init(), but it
* will pass in the Properties, otherwise it acts like a normal Extension.
*
* One instance of a strategy *per* JDBC connection instance will be created. If
* you need singleton-like behavior, you're on your own to provide it.
*/
public interface BalanceStrategy extends Extension {
/**
* Called by the driver to pick a new connection to route requests over.
*
* @param proxy
* the InvocationHandler that deals with actual method calls to
* the JDBC connection, and serves as a factory for new
* connections for this strategy via the
* createConnectionForHost() method.
*
* This proxy takes care of maintaining the response time list, map of
* host/ports to live connections, and taking connections out of the live
* connections map if they receive a network-related error while they are in
* use by the application.
* @param configuredHosts
* the list of hosts/ports (in "host:port" form) as passed in by
* the user.
* @param liveConnections
* a map of host/ports to "live" connections to them.
* @param responseTimes
* the list of response times for a <strong>transaction</strong>
* for each host in the configured hosts list.
* @param numRetries
* the number of times the driver expects this strategy to re-try
* connection attempts if creating a new connection fails.
* @return the physical JDBC connection for the application to use, based
* upon the strategy employed.
* @throws SQLException
* if a new connection can not be found or created by this
* strategy.
*
* @see LoadBalancingConnectionProxy#createConnectionForHost(String)
*/
public abstract ConnectionImpl pickConnection(
LoadBalancingConnectionProxy proxy, List<String> configuredHosts,
Map<String, ConnectionImpl> liveConnections, long[] responseTimes, int numRetries)
throws SQLException;
/*
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
There are special exceptions to the terms and conditions of the GPLv2 as it is applied to
this software, see the FLOSS License Exception
<http://www.mysql.com/about/legal/licensing/foss-exception.html>.
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; version 2
of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this
program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
Floor, Boston, MA 02110-1301 USA
*/
package com.mysql.jdbc;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
* Implement this interface to provide a new load balancing strategy for URLs of
* the form "jdbc:mysql:loadbalance://..", and provide the implementation class
* name as the configuration parameter "loadBalanceStrategy".
*
* The driver will not pass in a Connection instance when calling init(), but it
* will pass in the Properties, otherwise it acts like a normal Extension.
*
* One instance of a strategy *per* JDBC connection instance will be created. If
* you need singleton-like behavior, you're on your own to provide it.
*/
public interface BalanceStrategy extends Extension {
/**
* Called by the driver to pick a new connection to route requests over.
*
* @param proxy
* the InvocationHandler that deals with actual method calls to
* the JDBC connection, and serves as a factory for new
* connections for this strategy via the
* createConnectionForHost() method.
*
* This proxy takes care of maintaining the response time list, map of
* host/ports to live connections, and taking connections out of the live
* connections map if they receive a network-related error while they are in
* use by the application.
* @param configuredHosts
* the list of hosts/ports (in "host:port" form) as passed in by
* the user.
* @param liveConnections
* a map of host/ports to "live" connections to them.
* @param responseTimes
* the list of response times for a <strong>transaction</strong>
* for each host in the configured hosts list.
* @param numRetries
* the number of times the driver expects this strategy to re-try
* connection attempts if creating a new connection fails.
* @return the physical JDBC connection for the application to use, based
* upon the strategy employed.
* @throws SQLException
* if a new connection can not be found or created by this
* strategy.
*
* @see LoadBalancingConnectionProxy#createConnectionForHost(String)
*/
public abstract ConnectionImpl pickConnection(
LoadBalancingConnectionProxy proxy, List<String> configuredHosts,
Map<String, ConnectionImpl> liveConnections, long[] responseTimes, int numRetries)
throws SQLException;
}
Loading