Skip to content

Commit 1c1ec99

Browse files
committed
Add more comments to RpcEndpoint.onStop and fix onDrop
1 parent b998ec1 commit 1c1ec99

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

core/src/main/scala/org/apache/spark/rpc/RpcEndpoint.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ private[spark] trait RpcEndpoint {
116116
}
117117

118118
/**
119-
* Invoked when [[RpcEndpoint]] is stopping.
119+
* Invoked when [[RpcEndpoint]] is stopping. `self` will be `null` in this method and you cannot
120+
* use it to send or ask messages.
120121
*/
121122
def onStop(): Unit = {
122123
// By default, do nothing.

core/src/main/scala/org/apache/spark/rpc/netty/Inbox.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private[netty] class Inbox(
178178
}
179179
}
180180
if (dropped) {
181-
onDrop()
181+
onDrop(message)
182182
}
183183
}
184184

@@ -197,7 +197,7 @@ private[netty] class Inbox(
197197
}
198198

199199
// Visible for testing.
200-
protected def onDrop(message: Any): Unit = {
200+
protected def onDrop(message: InboxMessage): Unit = {
201201
logWarning(s"Drop ${message} because $endpointRef is stopped")
202202
}
203203

core/src/test/scala/org/apache/spark/rpc/netty/InboxSuite.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class InboxSuite extends SparkFunSuite {
7272

7373
val numDroppedMessages = new AtomicInteger(0)
7474
val inbox = new Inbox(endpointRef, endpoint) {
75-
override def onDrop(message: Any): Unit = {
75+
override def onDrop(message: InboxMessage): Unit = {
7676
numDroppedMessages.incrementAndGet()
7777
}
7878
}

0 commit comments

Comments
 (0)