serge 01/12/07 13:51:59
Modified: src/java/org/apache/james/mailrepository
JDBCMailRepository.java JDBCSpoolRepository.java
Log:
Removed hack to wrap excalibur's db conn 'pooling' code.
Revision Changes Path
1.13 +5 -31
jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
Index: JDBCMailRepository.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- JDBCMailRepository.java 2001/12/03 22:59:10 1.12
+++ JDBCMailRepository.java 2001/12/07 21:51:59 1.13
@@ -214,7 +214,7 @@
datasource = (DataSourceComponent)datasources.select(datasourceName);
// Test the connection to the database, by getting the DatabaseMetaData.
- Connection conn = getConnection();
+ Connection conn = datasource.getConnection();
try {
// Initialise the sql strings.
@@ -298,7 +298,7 @@
//System.err.println("storing " + mc.getName());
Connection conn = null;
try {
- conn = getConnection();
+ conn = datasource.getConnection();
//Need to determine whether need to insert this record, or update it.
@@ -448,7 +448,7 @@
//System.err.println("retrieving " + key);
Connection conn = null;
try {
- conn = getConnection();
+ conn = datasource.getConnection();
PreparedStatement retrieveMessage =
conn.prepareStatement(sqlQueries.getSqlString("retrieveMessageSQL",
true));
@@ -517,7 +517,7 @@
if (lock(key)) {
Connection conn = null;
try {
- conn = getConnection();
+ conn = datasource.getConnection();
PreparedStatement removeMessage =
conn.prepareStatement(sqlQueries.getSqlString("removeMessageSQL", true));
removeMessage.setString(1, key);
@@ -547,7 +547,7 @@
//System.err.println("listing messages");
Connection conn = null;
try {
- conn = getConnection();
+ conn = datasource.getConnection();
PreparedStatement listMessages =
conn.prepareStatement(sqlQueries.getSqlString("listMessagesSQL",
true));
listMessages.setString(1, repositoryName);
@@ -572,32 +572,6 @@
}
}
}
- }
-
- /**
- * Opens a database connection.
- */
- protected Connection getConnection() {
- int attempts = 0;
- while (attempts < 1000) {
- try {
- return datasource.getConnection();
- } catch (SQLException e1) {
- if (e1.getMessage().equals("Could not create enough Components to
service your request.")) {
- //stupid pool
- try {
- Thread.sleep(50);
- } catch (InterruptedException ie) {
- //ignore
- }
- attempts++;
- } else {
- throw new CascadingRuntimeException(
- "An exception occurred getting a database connection.", e1);
- }
- }
- }
- throw new RuntimeException("Failed to get a connection after " + attempts +
" attempts");
}
public boolean equals(Object obj) {
1.8 +1 -1
jakarta-james/src/java/org/apache/james/mailrepository/JDBCSpoolRepository.java
Index: JDBCSpoolRepository.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/mailrepository/JDBCSpoolRepository.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JDBCSpoolRepository.java 2001/12/03 22:58:50 1.7
+++ JDBCSpoolRepository.java 2001/12/07 21:51:59 1.8
@@ -185,7 +185,7 @@
PreparedStatement listMessages = null;
ResultSet rsListMessages = null;
try {
- conn = getConnection();
+ conn = datasource.getConnection();
listMessages =
conn.prepareStatement(sqlQueries.getSqlString("listMessagesSQL", true));
listMessages.setString(1, repositoryName);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>