Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ class ReceiverTracker(ssc: StreamingContext, skipReceiverLaunch: Boolean = false
*/
private def startReceiver(receiver: Receiver[_], scheduledExecutors: Seq[String]): Unit = {
val receiverId = receiver.streamId
if (!isTrackerStarted) {
if (isTrackerStopping || isTrackerStopped) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this a internal function? def shouldStartReceiver: Boolean = !(isTrackerStopping || isTrackerStopped)
and then use if (!shouldStartReceiver) { ... }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And add comments that its okay to start when the state = initialized / started

onReceiverJobFinish(receiverId)
return
}
Expand All @@ -494,14 +494,14 @@ class ReceiverTracker(ssc: StreamingContext, skipReceiverLaunch: Boolean = false
// We will keep restarting the receiver job until ReceiverTracker is stopped
future.onComplete {
case Success(_) =>
if (!isTrackerStarted) {
if (isTrackerStopping || isTrackerStopped) {
onReceiverJobFinish(receiverId)
} else {
logInfo(s"Restarting Receiver $receiverId")
self.send(RestartReceiver(receiver))
}
case Failure(e) =>
if (!isTrackerStarted) {
if (isTrackerStopping || isTrackerStopped) {
onReceiverJobFinish(receiverId)
} else {
logError("Receiver has been stopped. Try to restart it.", e)
Expand Down