You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by oz...@apache.org on 2004/08/03 13:02:48 UTC
cvs commit: jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms AbstractRDBMSStore.java JDBCAwareInputStream.java StandardRDBMSAdapter.java
ozeigermann 2004/08/03 04:02:48
Modified: src/stores/org/apache/slide/store/impl/rdbms
AbstractRDBMSStore.java JDBCAwareInputStream.java
StandardRDBMSAdapter.java
Log:
Assure all temporary connections for read only are committed before
they are closed and rescheduled.
Revision Changes Path
1.10 +73 -17 jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/AbstractRDBMSStore.java
Index: AbstractRDBMSStore.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/AbstractRDBMSStore.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AbstractRDBMSStore.java 28 Jul 2004 09:34:17 -0000 1.9
+++ AbstractRDBMSStore.java 3 Aug 2004 11:02:47 -0000 1.10
@@ -299,9 +299,17 @@
} finally {
if (connection != null) {
try {
- connection.close();
+ if (!tmCommits) {
+ connection.commit();
+ }
} catch (SQLException e) {
getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ } finally {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ }
}
}
}
@@ -355,9 +363,17 @@
} finally {
if (connection != null) {
try {
- connection.close();
+ if (!tmCommits) {
+ connection.commit();
+ }
} catch (SQLException e) {
- getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ throw new ServiceAccessException(this, e);
+ } finally {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ }
}
}
}
@@ -384,9 +400,17 @@
} finally {
if (connection != null) {
try {
- connection.close();
+ if (!tmCommits) {
+ connection.commit();
+ }
} catch (SQLException e) {
- getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ throw new ServiceAccessException(this, e);
+ } finally {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ }
}
}
}
@@ -485,9 +509,17 @@
} finally {
if (connection != null) {
try {
- connection.close();
+ if (!tmCommits) {
+ connection.commit();
+ }
} catch (SQLException e) {
- getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ throw new ServiceAccessException(this, e);
+ } finally {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ }
}
}
}
@@ -563,9 +595,17 @@
} finally {
if (connection != null) {
try {
- connection.close();
+ if (!tmCommits) {
+ connection.commit();
+ }
} catch (SQLException e) {
- getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ throw new ServiceAccessException(this, e);
+ } finally {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ }
}
}
}
@@ -596,9 +636,17 @@
} finally {
if (connection != null) {
try {
- connection.close();
+ if (!tmCommits) {
+ connection.commit();
+ }
} catch (SQLException e) {
- getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ throw new ServiceAccessException(this, e);
+ } finally {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ }
}
}
}
@@ -666,9 +714,17 @@
} finally {
if (connection != null) {
try {
- connection.close();
+ if (!tmCommits) {
+ connection.commit();
+ }
} catch (SQLException e) {
- getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ throw new ServiceAccessException(this, e);
+ } finally {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ }
}
}
}
1.6 +18 -7 jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/JDBCAwareInputStream.java
Index: JDBCAwareInputStream.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/JDBCAwareInputStream.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JDBCAwareInputStream.java 28 Jul 2004 09:34:17 -0000 1.5
+++ JDBCAwareInputStream.java 3 Aug 2004 11:02:47 -0000 1.6
@@ -31,6 +31,9 @@
import java.sql.SQLException;
import java.sql.Statement;
+import org.apache.slide.common.ServiceAccessException;
+import org.apache.slide.util.logger.Logger;
+
/**
* Wrapper for an input stream that has come from a JDBC connection. This
* wrapper also closes the underlying JDBC result set - freeing precious system
@@ -95,10 +98,18 @@
} finally {
try {
if (connection != null) {
- connection.close();
+ try {
+ connection.commit();
+ } catch (SQLException e) {
+ throw new IOException(e.getMessage());
+ } finally {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ throw new IOException(e.getMessage());
+ }
+ }
}
- } catch (SQLException e) {
- throw new IOException(e.getMessage());
} finally {
super.close();
}
1.30 +19 -10 jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/StandardRDBMSAdapter.java
Index: StandardRDBMSAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/StandardRDBMSAdapter.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- StandardRDBMSAdapter.java 28 Jul 2004 09:34:16 -0000 1.29
+++ StandardRDBMSAdapter.java 3 Aug 2004 11:02:47 -0000 1.30
@@ -746,10 +746,6 @@
revisionDescriptor.setContentLength(ziputil.getContentLength());
is = ziputil.getInputStream();
result.setContent(is);
- if (temporaryConnection) {
- // XXX is needed, as calling store does not know if connection should be closed now
- connection.close();
- }
} else {
if (temporaryConnection) {
result.setContent(new JDBCAwareInputStream(is, statement, res, connection));
@@ -758,9 +754,22 @@
}
}
} finally {
- // do not close when not compressed, as stream needs to be read before
+ // do not close when not compressed, as stream needs to be read
+ // before
if (bcompress) {
- close(statement, res);
+ try {
+ if (temporaryConnection) {
+ // XXX is needed, as calling store does not know if
+ // connection should be closed now
+ try {
+ connection.commit();
+ } finally {
+ connection.close();
+ }
+ }
+ } finally {
+ close(statement, res);
+ }
}
}
} catch (SQLException e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org