[jboss-cvs] JBossAS SVN: r76212 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 24 22:35:56 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-07-24 22:35:56 -0400 (Thu, 24 Jul 2008)
New Revision: 76212

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ModClusterServiceDRMEntry.java
Log:
[JBAS-5659] Implement equals/hashCode

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ModClusterServiceDRMEntry.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ModClusterServiceDRMEntry.java	2008-07-25 02:35:28 UTC (rev 76211)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ModClusterServiceDRMEntry.java	2008-07-25 02:35:56 UTC (rev 76212)
@@ -139,7 +139,43 @@
       
       return result;
    }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      
+      if (obj instanceof ModClusterServiceDRMEntry)
+      {
+         ModClusterServiceDRMEntry other = (ModClusterServiceDRMEntry) obj;
+         return (this.peer.equals(other.peer) 
+                   && safeEquals(this.mcmpServerStates, other.mcmpServerStates)
+                   && safeEquals(this.jvmRoutes, other.jvmRoutes));
+      }
+      return false;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = 17;
+      result += 23 * this.peer.hashCode();
+      result += 23 * (this.mcmpServerStates == null ? 0 : this.mcmpServerStates.hashCode());
+      result += 23 * (this.jvmRoutes == null ? 0 : this.jvmRoutes.hashCode());
+      return result;
+   }
    
-   
+   @Override
+   public String toString()
+   {
+      return new StringBuilder(getClass().getName())
+                     .append("{peer=").append(peer).append("}").toString();
+   }
 
+   private boolean safeEquals(Object a, Object b)
+   {
+      return (a == b || (a != null && a.equals(b)));
+   }
+
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list