Github user shivaram commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15433#discussion_r83043023
  
    --- Diff: core/src/main/scala/org/apache/spark/api/r/RBackendHandler.scala 
---
    @@ -263,18 +264,19 @@ private[r] object JVMObjectTracker {
     
       // TODO: This map should be thread-safe if we want to support multiple
       // connections at the same time
    -  private[this] val objMap = new HashMap[String, Object]
    +  private[this] val objMap: ConcurrentMap[String, Object] =
    +    new MapMaker().weakValues().makeMap[String, Object]()
     
       // TODO: We support only one connection now, so an integer is fine.
       // Investigate using use atomic integer in the future.
       private[this] var objCounter: Int = 0
     
       def getObject(id: String): Object = {
    -    objMap(id)
    +    objMap.get(id)
       }
     
       def get(id: String): Option[Object] = {
    -    objMap.get(id)
    +    Option(objMap.get(id))
       }
     
       def put(obj: Object): String = {
    --- End diff --
    
    There is a another JIRA related to thread safety of this class 
https://issues.apache.org/jira/browse/SPARK-17823 - It might be good address 
that in this PR ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to