[jboss-cvs] JBossAS SVN: r78742 - branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/stateful.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 22 00:42:29 EDT 2008


Author: dstephan
Date: 2008-09-22 00:42:29 -0400 (Mon, 22 Sep 2008)
New Revision: 78742

Modified:
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/stateful/StatefulBeanContext.java
Log:
JIRA-1169 - implementing equals/hashcode to retain identity after activating a passive bean. Allows bean to be removed from pool when destroyed.

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/stateful/StatefulBeanContext.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/stateful/StatefulBeanContext.java	2008-09-22 04:37:26 UTC (rev 78741)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/stateful/StatefulBeanContext.java	2008-09-22 04:42:29 UTC (rev 78742)
@@ -905,6 +905,30 @@
       }
    }
    
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+
+      // Don't use instanceof check here as subclasses w/ same id are not equal
+      if (obj != null && obj.getClass() == getClass())
+      {
+         StatefulBeanContext other = (StatefulBeanContext) obj;
+         return (containerClusterUid.equals(other.containerClusterUid) && id.equals(other.id));
+      }
+      return false;
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      int result = 11;
+      result = 29 * result + containerClusterUid.hashCode();
+      result = 29 * result + id.hashCode();
+      return result;
+   } 
+   
    private static class XPCCloseSynchronization implements Synchronization
    {
       private StatefulBeanContext ctx;




More information about the jboss-cvs-commits mailing list