User: mulder
Date: 00/08/31 10:28:48
Modified: src/main/org/jboss/minerva/pools ObjectPool.java
PoolEvent.java
Log:
Non-transactional pools and JDBC 1/2 wrapper transactional pools will now
boot a connection out of the pool if there's an error during commit or
rollback. Note that with a native JDBC 2 Standard Extension driver, we
have no way of knowing what method caused an exception so the only way to
achieve this is to set the invalidateOnError property, which boots the
connection for *all* exceptions.
Revision Changes Path
1.6 +2 -2 jboss/src/main/org/jboss/minerva/pools/ObjectPool.java
Index: ObjectPool.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/pools/ObjectPool.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ObjectPool.java 2000/08/30 12:41:52 1.5
+++ ObjectPool.java 2000/08/31 17:28:48 1.6
@@ -28,7 +28,7 @@
* <LI>Shut it down</LI>
* </OL>
* @see org.jboss.minerva.pools.PooledObject
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @author Aaron Mulder ([EMAIL PROTECTED])
*/
public class ObjectPool implements PoolEventListener {
@@ -703,7 +703,7 @@
* is set, the object will be removed from the pool entirely.
*/
public void objectError(PoolEvent evt) {
- if(invalidateOnError)
+ if(invalidateOnError || evt.isCatastrophic())
markObjectAsInvalid(evt.getSource());
releaseObject(evt.getSource());
}
1.2 +18 -1 jboss/src/main/org/jboss/minerva/pools/PoolEvent.java
Index: PoolEvent.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/pools/PoolEvent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PoolEvent.java 2000/06/02 13:48:45 1.1
+++ PoolEvent.java 2000/08/31 17:28:48 1.2
@@ -13,7 +13,7 @@
* object was used, closed, or had an error occur. The typical response is
* to update the last used time in the pool for used events, and return the
* object to the pool for closed or error events.
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
* @author Aaron Mulder ([EMAIL PROTECTED])
*/
public class PoolEvent extends EventObject {
@@ -38,6 +38,7 @@
public final static int OBJECT_USED = -8986434;
private int type;
+ private boolean catastrophic = false;
/**
* Create a new event.
@@ -62,5 +63,21 @@
*/
public int getType() {
return type;
+ }
+
+ /**
+ * Gets whether an object error was so bad that the object should not
+ * be reused by the pool. This is meaningful for error events only.
+ */
+ public boolean isCatastrophic() {
+ return catastrophic;
+ }
+
+ /**
+ * Marks this as an error so severe that the object should not be reused by
+ * the pool.
+ */
+ public void setCatastrophic() {
+ catastrophic = true;
}
}