Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

Commit

Permalink
Stop sending events after knowing node failure
Browse files Browse the repository at this point in the history
This patch aims to stop sending events to a node after knowing that node is failed.
  • Loading branch information
Ning Zhang committed May 7, 2015
1 parent 427bb1c commit 78397ea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/scala/com/walmartlabs/mupd8/MUCluster.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ class MUCluster[T <: MapUpdateClass[T]](self: Host,

def send(dest: Host, obj: T) {
def _send(retryCount: Int, destip: String, obj: T): Boolean = {
if (retryCount == 0) {
if (appRun.candidateRing != null && !appRun.candidateRing.ips.contains(destip)) {
warn("Did not send this event, because its destination may not be accessible and will be removed from the ring")
false
} else if (retryCount == 0) {
false
} else {
if (!client.send(destip, obj)) {
warn("Failed to send event (" + obj + ") to destination " + destip + " at retry : " + retryCount)
Thread.sleep(10000)
Thread.sleep(5000)
_send(retryCount - 1, destip, obj)
} else {
true
Expand Down

0 comments on commit 78397ea

Please sign in to comment.