jmcnally 02/05/06 11:47:14
Modified: src/java/org/apache/torque/manager MethodCacheKey.java
Log:
throw an exception if a key is returned to the pool multiple times (before
being borrowed again). This should not happen any longer, but it could help
in debugging if the problem arises again.
Revision Changes Path
1.5 +8 -2
jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodCacheKey.java
Index: MethodCacheKey.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodCacheKey.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MethodCacheKey.java 15 Apr 2002 16:24:06 -0000 1.4
+++ MethodCacheKey.java 6 May 2002 18:47:14 -0000 1.5
@@ -49,6 +49,7 @@
import java.io.Serializable;
import org.apache.commons.lang.Objects;
import org.apache.commons.pool.BasePoolableObjectFactory;
+import org.apache.torque.TorqueException;
public class MethodCacheKey
implements Serializable
@@ -210,7 +211,7 @@
if ( obj instanceof MethodCacheKey )
{
MethodCacheKey sck = (MethodCacheKey)obj;
- equal = sck.n == n;
+ equal = (sck.n == n);
equal &= Objects.equals(sck.method, method);
equal &= Objects.equals(sck.instanceOrClass, instanceOrClass);
if (equal && n > 0)
@@ -268,7 +269,7 @@
public String toString()
{
StringBuffer sb = new StringBuffer(50);
- sb.append(instanceOrClass.toString());
+ sb.append(instanceOrClass);
sb.append("::");
sb.append(method).append('(');
if (n > 0)
@@ -317,6 +318,11 @@
throws Exception
{
MethodCacheKey key = (MethodCacheKey)obj;
+ if (key.instanceOrClass == null && key.method == null)
+ {
+ throw new TorqueException(
+ "Attempted to return key to pool twice.");
+ }
key.instanceOrClass = null;
key.method = null;
key.arg1 = null;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>