You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "waitinfuture (via GitHub)" <gi...@apache.org> on 2023/06/19 11:52:03 UTC

[GitHub] [incubator-celeborn] waitinfuture commented on a diff in pull request #1605: [CELEBORN-695] Fix UnsupportedOperationException by refactoring WorkerInfo

waitinfuture commented on code in PR #1605:
URL: https://github.com/apache/incubator-celeborn/pull/1605#discussion_r1233948273


##########
common/src/main/scala/org/apache/celeborn/common/meta/WorkerInfo.scala:
##########
@@ -34,12 +34,19 @@ class WorkerInfo(
     val pushPort: Int,
     val fetchPort: Int,
     val replicatePort: Int,
-    val diskInfos: util.Map[String, DiskInfo],
-    val userResourceConsumption: util.Map[UserIdentifier, ResourceConsumption],
-    var endpoint: RpcEndpointRef) extends Serializable with Logging {
+    _diskInfos: util.Map[String, DiskInfo],
+    _userResourceConsumption: util.Map[UserIdentifier, ResourceConsumption]) extends Serializable
+  with Logging {
   var unknownDiskSlots = new java.util.HashMap[String, Integer]()
   var networkLocation = "/default-rack"
   var lastHeartbeat: Long = 0
+  val diskInfos =
+    if (_diskInfos != null) JavaUtils.newConcurrentHashMap[String, DiskInfo](_diskInfos) else null

Review Comment:
   Got your point. I just feel that it's hard to totally avoid null, especially for non-Collection members without or with a heavy default constructor.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@celeborn.apache.org

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