Github user srowen commented on a diff in the pull request:
    --- 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 --
    It kind of seems like this class is meant to be thread-safe, but this 
isn't. You could use `AtomicLong` and `getAndIncrement`?

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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to