You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2012/05/10 14:52:58 UTC
svn commit: r1336649 - in
/incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core:
database/ jdbcpool/
Author: kwright
Date: Thu May 10 12:52:58 2012
New Revision: 1336649
URL: http://svn.apache.org/viewvc?rev=1336649&view=rev
Log:
Get it all to build.
Modified:
incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java
incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java
Modified: incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java?rev=1336649&r1=1336648&r2=1336649&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java (original)
+++ incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java Thu May 10 12:52:58 2012
@@ -93,8 +93,7 @@ public class ConnectionFactory
maxDBConnections, 300000L);
cp = cpm.getPool(database);
}
- rval = new WrappedConnection(cp, getConnectionWithRetries(database, null, null));
- return rval;
+ return getConnectionWithRetries(cp);
}
catch (Exception e)
{
@@ -110,13 +109,12 @@ public class ConnectionFactory
public static void releaseAll()
{
- //???
if (poolManager != null)
poolManager.releaseAll();
}
- protected static Connection getConnectionWithRetries(String dbURL, String userName, String password)
- throws Exception
+ protected static WrappedConnection getConnectionWithRetries(ConnectionPool cp)
+ throws SQLException, ManifoldCFException
{
// If we have a problem, we will wait a grand total of 30 seconds
int retryCount = 3;
@@ -124,20 +122,19 @@ public class ConnectionFactory
{
try
{
- Connection rval;
- if (userName != null && userName.length() > 0)
- rval = DriverManager.getConnection(dbURL,userName,password);
- else
- rval = DriverManager.getConnection(dbURL);
- return rval;
+ return cp.getConnection();
}
- catch (Exception e)
+ catch (SQLException e)
{
if (retryCount == 0)
throw e;
// Eat the exception and try again
retryCount--;
}
+ catch (InterruptedException e)
+ {
+ throw new ManifoldCFException("Interrupted",ManifoldCFException.INTERRUPTED);
+ }
try
{
// Ten seconds is a long time
Modified: incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java?rev=1336649&r1=1336648&r2=1336649&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java (original)
+++ incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java Thu May 10 12:52:58 2012
@@ -1388,7 +1388,7 @@ public class DBInterfaceDerby extends Da
case TRANSACTION_READCOMMITTED:
try
{
- executeViaThread(connection,"SET ISOLATION READ COMMITTED",null,false,0,null,null);
+ executeViaThread(connection.getConnection(),"SET ISOLATION READ COMMITTED",null,false,0,null,null);
}
catch (Error e)
{
@@ -1407,7 +1407,7 @@ public class DBInterfaceDerby extends Da
case TRANSACTION_SERIALIZED:
try
{
- executeViaThread(connection,"SET ISOLATION SERIALIZABLE",null,false,0,null,null);
+ executeViaThread(connection.getConnection(),"SET ISOLATION SERIALIZABLE",null,false,0,null,null);
}
catch (Error e)
{
@@ -1475,7 +1475,7 @@ public class DBInterfaceDerby extends Da
{
try
{
- connection.setAutoCommit(false);
+ connection.getConnection().setAutoCommit(false);
}
catch (java.sql.SQLException e)
{
@@ -1498,8 +1498,8 @@ public class DBInterfaceDerby extends Da
{
if (connection != null)
{
- connection.commit();
- connection.setAutoCommit(true);
+ connection.getConnection().commit();
+ connection.getConnection().setAutoCommit(true);
}
}
catch (java.sql.SQLException e)
@@ -1526,8 +1526,8 @@ public class DBInterfaceDerby extends Da
{
if (connection != null)
{
- connection.rollback();
- connection.setAutoCommit(true);
+ connection.getConnection().rollback();
+ connection.getConnection().setAutoCommit(true);
}
}
catch (java.sql.SQLException e)
Modified: incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java?rev=1336649&r1=1336648&r2=1336649&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java (original)
+++ incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java Thu May 10 12:52:58 2012
@@ -1374,8 +1374,8 @@ public class DBInterfaceHSQLDB extends D
{
try
{
- connection.setAutoCommit(false);
- connection.setTransactionIsolation(desiredTransactionType);
+ connection.getConnection().setAutoCommit(false);
+ connection.getConnection().setTransactionIsolation(desiredTransactionType);
}
catch (java.sql.SQLException e)
{
@@ -1398,8 +1398,8 @@ public class DBInterfaceHSQLDB extends D
{
if (connection != null)
{
- connection.commit();
- connection.setAutoCommit(true);
+ connection.getConnection().commit();
+ connection.getConnection().setAutoCommit(true);
}
}
catch (java.sql.SQLException e)
@@ -1426,8 +1426,8 @@ public class DBInterfaceHSQLDB extends D
{
if (connection != null)
{
- connection.rollback();
- connection.setAutoCommit(true);
+ connection.getConnection().rollback();
+ connection.getConnection().setAutoCommit(true);
}
}
catch (java.sql.SQLException e)
Modified: incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java?rev=1336649&r1=1336648&r2=1336649&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java (original)
+++ incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java Thu May 10 12:52:58 2012
@@ -1018,7 +1018,7 @@ public class DBInterfaceMySQL extends Da
{
try
{
- executeViaThread(connection,"START TRANSACTION",null,false,0,null,null);
+ executeViaThread(connection.getConnection(),"START TRANSACTION",null,false,0,null,null);
}
catch (ManifoldCFException e)
{
@@ -1032,7 +1032,7 @@ public class DBInterfaceMySQL extends Da
{
try
{
- executeViaThread(connection,"COMMIT",null,false,0,null,null);
+ executeViaThread(connection.getConnection(),"COMMIT",null,false,0,null,null);
}
catch (ManifoldCFException e)
{
@@ -1046,7 +1046,7 @@ public class DBInterfaceMySQL extends Da
{
try
{
- executeViaThread(connection,"ROLLBACK",null,false,0,null,null);
+ executeViaThread(connection.getConnection(),"ROLLBACK",null,false,0,null,null);
}
catch (ManifoldCFException e)
{
Modified: incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java?rev=1336649&r1=1336648&r2=1336649&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java (original)
+++ incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java Thu May 10 12:52:58 2012
@@ -1148,7 +1148,7 @@ public class DBInterfacePostgreSQL exten
{
try
{
- executeViaThread(connection,"START TRANSACTION",null,false,0,null,null);
+ executeViaThread(connection.getConnection(),"START TRANSACTION",null,false,0,null,null);
}
catch (ManifoldCFException e)
{
@@ -1162,7 +1162,7 @@ public class DBInterfacePostgreSQL exten
{
try
{
- executeViaThread(connection,"COMMIT",null,false,0,null,null);
+ executeViaThread(connection.getConnection(),"COMMIT",null,false,0,null,null);
}
catch (ManifoldCFException e)
{
@@ -1177,7 +1177,7 @@ public class DBInterfacePostgreSQL exten
{
try
{
- executeViaThread(connection,"ROLLBACK",null,false,0,null,null);
+ executeViaThread(connection.getConnection(),"ROLLBACK",null,false,0,null,null);
}
catch (ManifoldCFException e)
{
Modified: incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java?rev=1336649&r1=1336648&r2=1336649&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java (original)
+++ incubator/lcf/branches/CONNECTORS-96/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPool.java Thu May 10 12:52:58 2012
@@ -60,6 +60,7 @@ public class ConnectionPool
public WrappedConnection getConnection()
throws SQLException, InterruptedException
{
+ System.out.println("getConnection()");
while (true)
{
synchronized (this)
@@ -81,15 +82,18 @@ public class ConnectionPool
break;
}
}
+ System.out.println("No freed connection found");
// Create a new connection. If we fail at this we need to restore the number of active connections, so catch any failures
Connection rval2 = null;
try
{
+ System.out.println("Calling DriverManage.getConnection() with '"+dbURL+"'");
if (userName != null)
rval2 = DriverManager.getConnection(dbURL, userName, password);
else
rval2 = DriverManager.getConnection(dbURL);
+ System.out.println("DriverManager.getConnection() done!");
}
finally
{