[jboss-svn-commits] JBL Code SVN: r21986 - in labs/jbosstm/trunk: ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Aug 29 06:22:28 EDT 2008
Author: mmusgrov
Date: 2008-08-29 06:22:28 -0400 (Fri, 29 Aug 2008)
New Revision: 21986
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputBuffer.java
labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java
labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionSynchronization.java
labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/DirectRecoverableConnection.java
labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/IndirectRecoverableConnection.java
labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/xa/RecoverableXAConnection.java
Log:
The wrapped connection is no longer closed when the transaction completes.
Fixes for JBTM-401
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputBuffer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputBuffer.java 2008-08-29 08:56:23 UTC (rev 21985)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputBuffer.java 2008-08-29 10:22:28 UTC (rev 21986)
@@ -402,8 +402,9 @@
if (sz > 0)
{
- _output.write(dummy.getBytes(), 0, dummy.getBytes().length);
- realign(dummy.getBytes().length);
+ byte[] bytes = dummy.getBytes();
+ _output.write(bytes, 0, bytes.length);
+ realign(bytes.length);
}
_output.flush();
Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java 2008-08-29 08:56:23 UTC (rev 21985)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java 2008-08-29 10:22:28 UTC (rev 21986)
@@ -375,8 +375,11 @@
}
else
{
- _recoveryConnection.close();
- _theConnection = null;
+ _recoveryConnection.closeCloseCurrentConnection();
+ if (_theConnection != null && !_theConnection.isClosed())
+ _theConnection.close();
+
+ _theConnection = null;
}
// what about connections without xaCon?
@@ -631,7 +634,7 @@
final java.sql.Connection getConnection() throws SQLException
{
- if (_theConnection != null)
+ if (_theConnection != null && !_theConnection.isClosed())
return _theConnection;
XAConnection xaConn = _recoveryConnection.getConnection();
Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionSynchronization.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionSynchronization.java 2008-08-29 08:56:23 UTC (rev 21985)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionSynchronization.java 2008-08-29 10:22:28 UTC (rev 21986)
@@ -64,7 +64,7 @@
}
try
{
- _recoveryConnection.close();
+ _recoveryConnection.closeCloseCurrentConnection();
}
catch (Exception ex)
{
Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/DirectRecoverableConnection.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/DirectRecoverableConnection.java 2008-08-29 08:56:23 UTC (rev 21985)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/DirectRecoverableConnection.java 2008-08-29 10:22:28 UTC (rev 21986)
@@ -242,30 +242,6 @@
public final void close ()
{
reset();
-
- synchronized (this)
- {
- if (_theConnection != null)
- {
- _theArjunaConnection.reset();
-
- // JDBC2ConnectionManager.remove(_theArjunaConnection);
- }
-
- if (_theModifier != null)
- {
- try
- {
- _theConnection = _theModifier.getConnection(_theConnection);
- }
- catch (Exception ex)
- {
- _theConnection = null;
- }
- }
- else
- _theConnection = null;
- }
}
public final void reset ()
@@ -283,7 +259,19 @@
{
return _theConnection;
}
-
+
+ public void closeCloseCurrentConnection() throws SQLException
+ {
+ synchronized (this)
+ {
+ if (_theConnection != null)
+ {
+ _theConnection.close();
+ _theConnection = null;
+ }
+ }
+ }
+
public XAConnection getConnection () throws SQLException
{
if (jdbcLogger.logger.isDebugEnabled())
Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/IndirectRecoverableConnection.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/IndirectRecoverableConnection.java 2008-08-29 08:56:23 UTC (rev 21985)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/IndirectRecoverableConnection.java 2008-08-29 10:22:28 UTC (rev 21986)
@@ -220,30 +220,6 @@
public final void close ()
{
reset();
-
- synchronized (this)
- {
- if (_theConnection != null)
- {
- _theArjunaConnection.reset();
-
- // JDBC2ConnectionManager.remove(_theArjunaConnection);
- }
-
- if (_theModifier != null)
- {
- try
- {
- _theConnection = _theModifier.getConnection(_theConnection);
- }
- catch (Exception ex)
- {
- _theConnection = null;
- }
- }
- else
- _theConnection = null;
- }
}
public final void reset ()
@@ -291,6 +267,18 @@
return _theConnection;
}
+ public void closeCloseCurrentConnection() throws SQLException
+ {
+ synchronized (this)
+ {
+ if (_theConnection != null)
+ {
+ _theConnection.close();
+ _theConnection = null;
+ }
+ }
+ }
+
public XAConnection getConnection () throws SQLException
{
if (jdbcLogger.logger.isDebugEnabled())
Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/xa/RecoverableXAConnection.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/xa/RecoverableXAConnection.java 2008-08-29 08:56:23 UTC (rev 21985)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/xa/RecoverableXAConnection.java 2008-08-29 10:22:28 UTC (rev 21986)
@@ -65,6 +65,7 @@
public XAConnection getConnection () throws SQLException;
public XAConnection getCurrentConnection () throws SQLException;
public XADataSource getDataSource () throws SQLException;
+ void closeCloseCurrentConnection() throws SQLException;
/**
* @return true if the connection is being used within a transaction,
More information about the jboss-svn-commits
mailing list