List:Internals« Previous MessageNext Message »
From:mmatthews Date:November 21 2005 9:24pm
Subject:Connector/J commit: r4582 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbc
View as plain text  
Modified:
   branches/branch_5_0/connector-j/CHANGES
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java
Log:
Fuller synchronization of Connection to avoid deadlocks when
      using multithreaded frameworks that multithread a single connection
      (usually not recommended, but the JDBC spec allows it anyways), 
      part of fix to BUG#14972).

Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES	2005-11-21 21:09:21 UTC (rev 4581)
+++ branches/branch_5_0/connector-j/CHANGES	2005-11-21 21:24:24 UTC (rev 4582)
@@ -71,6 +71,11 @@
       for CallableStatement's parameter metadata to return correct
       information for .getParameterClassName().
       
+    - Fuller synchronization of Connection to avoid deadlocks when
+      using multithreaded frameworks that multithread a single connection
+      (usually not recommended, but the JDBC spec allows it anyways), 
+      part of fix to BUG#14972).
+      
 xx-xx-05 - Version 3.1.12
 
     - Fixed client-side prepared statement bug with embedded ? inside

Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java	2005-11-21 21:09:21 UTC (rev 4581)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java	2005-11-21 21:24:24 UTC (rev 4582)
@@ -2157,7 +2157,7 @@
 	 *                if a database access error occurs
 	 * @see setAutoCommit
 	 */
-	public void commit() throws SQLException {
+	public synchronized void commit() throws SQLException {
 		checkClosed();
 
 		try {
@@ -2824,7 +2824,7 @@
 	 * @throws SQLException
 	 *             passed through from the constructor
 	 */
-	public java.sql.Statement createStatement() throws SQLException {
+	public synchronized java.sql.Statement createStatement() throws SQLException {
 		return createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
 				java.sql.ResultSet.CONCUR_READ_ONLY);
 	}
@@ -2841,7 +2841,7 @@
 	 * @exception SQLException
 	 *                if a database-access error occurs.
 	 */
-	public java.sql.Statement createStatement(int resultSetType,
+	public synchronized java.sql.Statement createStatement(int resultSetType,
 			int resultSetConcurrency) throws SQLException {
 		checkClosed();
 
@@ -2855,7 +2855,7 @@
 	/**
 	 * @see Connection#createStatement(int, int, int)
 	 */
-	public java.sql.Statement createStatement(int resultSetType,
+	public synchronized java.sql.Statement createStatement(int resultSetType,
 			int resultSetConcurrency, int resultSetHoldability)
 			throws SQLException {
 		if (getPedantic()) {
@@ -2916,7 +2916,7 @@
 	// resultSetConcurrency, streamResults, queryIsSelectOnly, catalog,
 	// unpackFields);
 	// }
-	ResultSet execSQL(Statement callingStatement, String sql, int maxRows,
+	synchronized ResultSet execSQL(Statement callingStatement, String sql, int maxRows,
 			Buffer packet, int resultSetType, int resultSetConcurrency,
 			boolean streamResults, boolean queryIsSelectOnly, String catalog,
 			boolean unpackFields) throws SQLException {
@@ -2925,7 +2925,7 @@
 				catalog, unpackFields, Statement.USES_VARIABLES_FALSE);
 	}
 
-	ResultSet execSQL(Statement callingStatement, String sql, int maxRows,
+	synchronized ResultSet execSQL(Statement callingStatement, String sql, int maxRows,
 			Buffer packet, int resultSetType, int resultSetConcurrency,
 			boolean streamResults, boolean queryIsSelectOnly, String catalog,
 			boolean unpackFields, byte queryUsesVariables) throws SQLException {
@@ -3143,7 +3143,7 @@
 	 *                if an error occurs
 	 * @see setAutoCommit
 	 */
-	public boolean getAutoCommit() throws SQLException {
+	public synchronized boolean getAutoCommit() throws SQLException {
 		return this.autoCommit;
 	}
 
@@ -3158,7 +3158,7 @@
 	 * @exception SQLException
 	 *                if a database access error occurs
 	 */
-	public String getCatalog() throws SQLException {
+	public synchronized String getCatalog() throws SQLException {
 		return this.database;
 	}
 
@@ -4168,7 +4168,7 @@
 	 * @throws SQLException
 	 *             DOCUMENT ME!
 	 */
-	public java.sql.CallableStatement prepareCall(String sql)
+	public synchronized java.sql.CallableStatement prepareCall(String sql)
 			throws SQLException {
 		if (this.getUseUltraDevWorkAround()) {
 			return new UltraDevWorkAround(prepareStatement(sql));
@@ -4236,7 +4236,7 @@
 	/**
 	 * @see Connection#prepareCall(String, int, int, int)
 	 */
-	public java.sql.CallableStatement prepareCall(String sql,
+	public synchronized java.sql.CallableStatement prepareCall(String sql,
 			int resultSetType, int resultSetConcurrency,
 			int resultSetHoldability) throws SQLException {
 		if (getPedantic()) {
@@ -4278,7 +4278,7 @@
 	 * @exception SQLException
 	 *                if a database access error occurs.
 	 */
-	public java.sql.PreparedStatement prepareStatement(String sql)
+	public synchronized java.sql.PreparedStatement prepareStatement(String sql)
 			throws SQLException {
 		return prepareStatement(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY,
 				java.sql.ResultSet.CONCUR_READ_ONLY);
@@ -4287,7 +4287,7 @@
 	/**
 	 * @see Connection#prepareStatement(String, int)
 	 */
-	public java.sql.PreparedStatement prepareStatement(String sql,
+	public synchronized java.sql.PreparedStatement prepareStatement(String sql,
 			int autoGenKeyIndex) throws SQLException {
 		java.sql.PreparedStatement pStmt = prepareStatement(sql);
 
@@ -4374,7 +4374,7 @@
 	/**
 	 * @see Connection#prepareStatement(String, int, int, int)
 	 */
-	public java.sql.PreparedStatement prepareStatement(String sql,
+	public synchronized java.sql.PreparedStatement prepareStatement(String sql,
 			int resultSetType, int resultSetConcurrency,
 			int resultSetHoldability) throws SQLException {
 		if (getPedantic()) {
@@ -4391,7 +4391,7 @@
 	/**
 	 * @see Connection#prepareStatement(String, int[])
 	 */
-	public java.sql.PreparedStatement prepareStatement(String sql,
+	public synchronized java.sql.PreparedStatement prepareStatement(String sql,
 			int[] autoGenKeyIndexes) throws SQLException {
 		java.sql.PreparedStatement pStmt = prepareStatement(sql);
 
@@ -4405,7 +4405,7 @@
 	/**
 	 * @see Connection#prepareStatement(String, String[])
 	 */
-	public java.sql.PreparedStatement prepareStatement(String sql,
+	public synchronized java.sql.PreparedStatement prepareStatement(String sql,
 			String[] autoGenKeyColNames) throws SQLException {
 		java.sql.PreparedStatement pStmt = prepareStatement(sql);
 
@@ -4935,7 +4935,7 @@
 	 * @exception SQLException
 	 *                if a database access error occurs
 	 */
-	public void setAutoCommit(boolean autoCommitFlag) throws SQLException {
+	public synchronized void setAutoCommit(boolean autoCommitFlag) throws SQLException {
 		checkClosed();
 
 		if (getAutoReconnectForPools()) {
@@ -5003,7 +5003,7 @@
 	 * @throws SQLException
 	 *             if a database access error occurs
 	 */
-	public void setCatalog(String catalog) throws SQLException {
+	public synchronized void setCatalog(String catalog) throws SQLException {
 		checkClosed();
 
 		if (catalog == null) {
@@ -5045,7 +5045,7 @@
 	 * @param failedOver
 	 *            The failedOver to set.
 	 */
-	public void setFailedOver(boolean flag) {
+	public synchronized void setFailedOver(boolean flag) {
 		this.failedOver = flag;
 	}
 
@@ -5095,7 +5095,7 @@
 	 * @exception SQLException
 	 *                if a database access error occurs
 	 */
-	public void setReadOnly(boolean readOnlyFlag) throws SQLException {
+	public synchronized void setReadOnly(boolean readOnlyFlag) throws SQLException {
 		checkClosed();
 		this.readOnly = readOnlyFlag;
 	}
@@ -5103,7 +5103,7 @@
 	/**
 	 * @see Connection#setSavepoint()
 	 */
-	public java.sql.Savepoint setSavepoint() throws SQLException {
+	public synchronized java.sql.Savepoint setSavepoint() throws SQLException {
 		MysqlSavepoint savepoint = new MysqlSavepoint();
 
 		setSavepoint(savepoint);
@@ -5146,7 +5146,7 @@
 	/**
 	 * @see Connection#setSavepoint(String)
 	 */
-	public java.sql.Savepoint setSavepoint(String name) throws SQLException {
+	public synchronized java.sql.Savepoint setSavepoint(String name) throws SQLException {
 		MysqlSavepoint savepoint = new MysqlSavepoint(name);
 
 		setSavepoint(savepoint);
@@ -5195,7 +5195,7 @@
 	 * @throws SQLException
 	 *             DOCUMENT ME!
 	 */
-	public void setTransactionIsolation(int level) throws SQLException {
+	public synchronized void setTransactionIsolation(int level) throws SQLException {
 		checkClosed();
 
 		if (this.hasIsolationLevels) {

Thread
Connector/J commit: r4582 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbcmmatthews21 Nov