[jboss-cvs] JBossAS SVN: r68296 - branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Dec 14 11:51:18 EST 2007
Author: adrian at jboss.org
Date: 2007-12-14 11:51:18 -0500 (Fri, 14 Dec 2007)
New Revision: 68296
Modified:
branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedConnection.java
branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedResultSet.java
branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedStatement.java
branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrapperDataSource.java
Log:
[JBAS-5083] - Add transaction active tests to the jdbc resource adapter
Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedConnection.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedConnection.java 2007-12-14 16:50:19 UTC (rev 68295)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedConnection.java 2007-12-14 16:51:18 UTC (rev 68296)
@@ -525,6 +525,11 @@
mc.checkTransaction();
}
+ void checkTransactionActive() throws SQLException
+ {
+ dataSource.checkTransactionActive();
+ }
+
/**
* The checkStatus method checks that the handle has not been closed and
* that it is associated with a managed connection.
@@ -537,6 +542,7 @@
throw new SQLException("Connection handle has been closed and is unusable");
if (mc == null)
throw new SQLException("Connection handle is not currently associated with a ManagedConnection");
+ checkTransactionActive();
}
/**
Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedResultSet.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedResultSet.java 2007-12-14 16:50:19 UTC (rev 68295)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedResultSet.java 2007-12-14 16:51:18 UTC (rev 68296)
@@ -1938,5 +1938,6 @@
if (closed)
throw new SQLException("The result set is closed.");
}
+ statement.checkTransactionActive();
}
}
\ No newline at end of file
Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedStatement.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedStatement.java 2007-12-14 16:50:19 UTC (rev 68295)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedStatement.java 2007-12-14 16:51:18 UTC (rev 68296)
@@ -574,6 +574,11 @@
{
lc.checkConfiguredQueryTimeout(this);
}
+
+ protected void checkTransactionActive() throws SQLException
+ {
+ lc.checkTransactionActive();
+ }
protected void internalClose() throws SQLException
{
Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrapperDataSource.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrapperDataSource.java 2007-12-14 16:50:19 UTC (rev 68295)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/adapter/jdbc/WrapperDataSource.java 2007-12-14 16:51:18 UTC (rev 68296)
@@ -33,7 +33,9 @@
import javax.resource.spi.ConnectionRequestInfo;
import javax.sql.DataSource;
import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import org.jboss.resource.connectionmanager.JTATransactionChecker;
import org.jboss.tm.TransactionTimeoutConfiguration;
import org.jboss.util.NestedSQLException;
@@ -144,4 +146,24 @@
throw new NestedSQLException(e);
}
}
+
+ /**
+ * Check whether a tranasction is active
+ *
+ * @throws SQLException if the transaction is not active, preparing, prepared or committing or for any error in the transaction manager
+ */
+ protected void checkTransactionActive() throws SQLException
+ {
+ if (cm == null)
+ throw new SQLException("No connection manager");
+ try
+ {
+ if (cm instanceof JTATransactionChecker)
+ ((JTATransactionChecker) cm).checkTransactionActive();
+ }
+ catch (Exception e)
+ {
+ throw new NestedSQLException(e);
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list