@@ -41,6 +41,9 @@ private[spark] abstract class RpcEnv(conf: SparkConf) {
4141 /**
4242 * Return RpcEndpointRef of the registered [[RpcEndpoint ]]. Will be used to implement
4343 * [[RpcEndpoint.self ]].
44+ *
45+ * Note: This method won't return null. `IllegalArgumentException` will be thrown if calling this
46+ * on a non-existent endpoint.
4447 */
4548 private [rpc] def endpointRef (endpoint : RpcEndpoint ): RpcEndpointRef
4649
@@ -203,14 +206,16 @@ private[spark] trait RpcEndpoint {
203206 }
204207
205208 /**
206- * Process messages from [[RpcEndpointRef.send ]] or [[RpcCallContext.reply) ]]
209+ * Process messages from [[RpcEndpointRef.send ]] or [[RpcCallContext.reply) ]]. If receiving a
210+ * unmatched message, [[SparkException ]] will be thrown and sent to `onError`.
207211 */
208212 def receive : PartialFunction [Any , Unit ] = {
209213 case _ => throw new SparkException (self + " does not implement 'receive'" )
210214 }
211215
212216 /**
213- * Process messages from [[RpcEndpointRef.sendWithReply ]]
217+ * Process messages from [[RpcEndpointRef.sendWithReply ]]. If receiving a unmatched message,
218+ * [[SparkException ]] will be thrown and sent to `onError`.
214219 */
215220 def receiveAndReply (context : RpcCallContext ): PartialFunction [Any , Unit ] = {
216221 case _ => context.sendFailure(new SparkException (self + " won't reply anything" ))
@@ -314,7 +319,8 @@ private[spark] abstract class RpcEndpointRef(@transient conf: SparkConf)
314319 /**
315320 * Send a message to the corresponding [[RpcEndpoint ]] and get its result within a default
316321 * timeout, or throw a SparkException if this fails even after the default number of retries.
317- * Because this method retries, the message handling in the receiver side should be idempotent.
322+ * The default `timeout` will be used in every trial of calling `sendWithReply`. Because this
323+ * method retries, the message handling in the receiver side should be idempotent.
318324 *
319325 * Note: this is a blocking action which may cost a lot of time, so don't call it in an message
320326 * loop of [[RpcEndpoint ]].
@@ -328,8 +334,8 @@ private[spark] abstract class RpcEndpointRef(@transient conf: SparkConf)
328334 /**
329335 * Send a message to the corresponding [[RpcEndpoint.receive ]] and get its result within a
330336 * specified timeout, throw a SparkException if this fails even after the specified number of
331- * retries. Because this method retries, the message handling in the receiver side should be
332- * idempotent.
337+ * retries. `timeout` will be used in every trial of calling `sendWithReply`. Because this method
338+ * retries, the message handling in the receiver side should be idempotent.
333339 *
334340 * Note: this is a blocking action which may cost a lot of time, so don't call it in an message
335341 * loop of [[RpcEndpoint ]].
0 commit comments