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

    https://github.com/apache/spark/pull/6457#discussion_r39757885
  
    --- Diff: core/src/main/scala/org/apache/spark/rpc/netty/Dispatcher.scala 
---
    @@ -0,0 +1,226 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.rpc.netty
    +
    +import java.util.concurrent.{ConcurrentHashMap, LinkedBlockingQueue, 
TimeUnit}
    +import javax.annotation.concurrent.GuardedBy
    +
    +import scala.collection.JavaConverters._
    +import scala.concurrent.Promise
    +import scala.util.control.NonFatal
    +
    +import org.apache.spark.{SparkException, Logging}
    +import org.apache.spark.network.client.RpcResponseCallback
    +import org.apache.spark.rpc._
    +import org.apache.spark.util.ThreadUtils
    +
    +private class RpcEndpointPair(val endpoint: RpcEndpoint, val endpointRef: 
NettyRpcEndpointRef)
    +
    +private[netty] class Dispatcher(nettyEnv: NettyRpcEnv) extends Logging {
    +
    +  private val endpointToInbox = new ConcurrentHashMap[RpcEndpoint, Inbox]()
    --- End diff --
    
    `nameToEndpoint` is necessary obviously. 
    
    `endpointToEndpointRef` is used to search RpcEndpointRef via RpcEndpoint. 
RpcEndpoint doesn't have a name field, so we need a map that uses `RpcEndpoint` 
as key. 
    
    Moreover, the items in these 3 Maps are removed in different phase. Items 
`nameToEndpoint` are removed when `unregisterRpcEndpoint` is called. Items in 
`endpointToEndpointRef` are removed just before calling `endpoint.onStop()`.  
Items in `endpointToInbox` are removed when Inbox.process return true.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to