ningyougang commented on a change in pull request #5074:
URL: https://github.com/apache/openwhisk/pull/5074#discussion_r612960141



##########
File path: 
common/scala/src/main/scala/org/apache/openwhisk/core/connector/Message.scala
##########
@@ -440,6 +440,34 @@ case class InvokerResourceMessage(status: String,
    * Serializes message to string. Must be idempotent.
    */
   override def serialize: String = 
InvokerResourceMessage.serdes.write(this).compactPrint
+
+  def canEqual(a: Any) = a.isInstanceOf[InvokerResourceMessage]
+
+  override def equals(that: Any): Boolean =
+    that match {
+      case that: InvokerResourceMessage => {
+        that.canEqual(this) &&
+        this.status == that.status &&
+        this.freeMemory == that.freeMemory &&
+        this.busyMemory == that.busyMemory &&
+        this.inProgressMemory == that.inProgressMemory &&
+        this.tags.toSet == that.tags.toSet
+        this.dedicatedNamespaces.toSet == that.dedicatedNamespaces.toSet
+      }
+      case _ => false
+    }
+
+  override def hashCode: Int = {
+    var result = 1;
+    val prime = 31
+    result = prime * result + status.hashCode()
+    result = prime * result + freeMemory.hashCode()
+    result = prime * result + busyMemory.hashCode()
+    result = prime * result + inProgressMemory.hashCode()
+    result = prime * result + tags.hashCode()
+    result = prime * result + dedicatedNamespaces.hashCode()
+    result
+  }

Review comment:
       Regarding InvokerResourceMessage's equals and hashCode, it seems we have 
no need to override these 2 methods.
   
![image](https://user-images.githubusercontent.com/11749867/114662004-8d50c480-9d2a-11eb-9673-850e46e5113c.png)
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to