Skip to content

Commit

Permalink
Fix issue that EC tryShutdown will have blocking problems apache#1765
Browse files Browse the repository at this point in the history
  • Loading branch information
peacewong committed Mar 21, 2022
1 parent 550f598 commit 8dae3e9
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,28 @@ trait SensibleExecutor extends Executor {

protected def onStatusChanged(fromStatus: NodeStatus, toStatus: NodeStatus): Unit

def transition(toStatus: NodeStatus): Unit = this synchronized {
def transition(toStatus: NodeStatus): Unit = {
lastActivityTime = System.currentTimeMillis
this.status match {
case NodeStatus.Failed | NodeStatus.Success =>
warn(s"$toString attempt to change status ${this.status} => $toStatus, ignore it.")
logger.warn(s"$toString attempt to change status ${this.status} => $toStatus, ignore it.")
return
case NodeStatus.ShuttingDown =>
toStatus match {
case NodeStatus.Failed | NodeStatus.Success =>
case _ =>
warn(s"$toString attempt to change a Executor from ShuttingDown to $toStatus, ignore it.")
logger.warn(s"$toString attempt to change a Executor from ShuttingDown to $toStatus, ignore it.")
return
}
case _ =>

}
if (NodeStatus.ShuttingDown != toStatus) {
logger.info(s"Waitiing lock release, to change status $status=>$toStatus.")
this synchronized {
logger.info(s"Finished wait lock release, to change status $status=>$toStatus.")
}
}
info(s"$toString changed status $status => $toStatus.")
val oldState = status
this.status = toStatus
Expand Down

0 comments on commit 8dae3e9

Please sign in to comment.