User: mulder
Date: 00/10/19 13:01:19
Modified: src/main/org/jboss/minerva/factories
XAConnectionFactory.java
Log:
- Errors in the XA wrapper after the user called close (i.e. during
ejbStore at transaction end) will now propogate and cause the
connection to be dropped if the pool is configured for it.
- If a connection is dropped due to an error, and the pool falls
below the minimum size, a new instance will be created to compensate.
- Oracle DB mapping changed to "Oracle 7". A new "Oracle 8" mapping is
forthcoming. With Oracle 7, you can only have one serialized Java
object per table.
- Pool minimum size cannot be greater than maximum size (unless max is
0 = unlimited).
- Result set wrapper now propogates errors appropriately.
Revision Changes Path
1.9 +20 -3
jboss/src/main/org/jboss/minerva/factories/XAConnectionFactory.java
Index: XAConnectionFactory.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/factories/XAConnectionFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XAConnectionFactory.java 2000/10/05 15:41:12 1.8
+++ XAConnectionFactory.java 2000/10/19 20:01:19 1.9
@@ -38,7 +38,7 @@
* connection, the same previous connection will be returned. Otherwise,
* you won't be able to share changes across connections like you can with
* the native JDBC 2 Standard Extension implementations.</P>
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
* @author Aaron Mulder ([EMAIL PROTECTED])
*/
public class XAConnectionFactory extends PoolObjectFactory {
@@ -47,7 +47,7 @@
private String userName;
private String password;
private String tmJndiName;
- private ConnectionEventListener listener;
+ private ConnectionEventListener listener, errorListener;
private TransactionListener transListener;
private ObjectPool pool;
private PrintWriter log;
@@ -61,9 +61,21 @@
public XAConnectionFactory() throws NamingException {
ctx = new InitialContext();
wrapperTx = new HashMap();
+ errorListener = new ConnectionEventListener() {
+ public void connectionErrorOccurred(ConnectionEvent evt) {
+ if(pool.isInvalidateOnError()) {
+ pool.markObjectAsInvalid(evt.getSource());
+ }
+ }
+ public void connectionClosed(ConnectionEvent evt) {}
+ };
+
listener = new ConnectionEventListener() {
-
+
public void connectionErrorOccurred(ConnectionEvent evt) {
+ if(pool.isInvalidateOnError()) {
+ pool.markObjectAsInvalid(evt.getSource());
+ }
closeConnection(evt, XAResource.TMFAIL);
}
@@ -97,12 +109,16 @@
pool.markObjectAsInvalid(con);
}
pool.releaseObject(con);
+ } else {
+ // Still track errors, but don't try to close again.
+ con.addConnectionEventListener(errorListener);
}
}
}
};
transListener = new TransactionListener() {
public void transactionFinished(XAConnectionImpl con) {
+ con.removeConnectionEventListener(errorListener);
con.clearTransactionListener();
Object tx = wrapperTx.remove(con);
if(tx != null)
@@ -111,6 +127,7 @@
}
public void transactionFailed(XAConnectionImpl con) {
+ con.removeConnectionEventListener(errorListener);
con.clearTransactionListener();
Object tx = wrapperTx.remove(con);
if(tx != null)