Created
July 13, 2015 22:26
-
-
Save kluyg/46ae3dee9000a358edf9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyRetryPolicy(maxRetries: Int) extends RetryPolicy { | |
override def onReadTimeout(statement: Statement, | |
cl: ConsistencyLevel, | |
requiredResponses: Int, | |
receivedResponses: Int, | |
dataRetrieved: Boolean, | |
nbRetry: Int): RetryDecision = { | |
if (nbRetry < maxRetries) RetryDecision.retry(cl) else RetryDecision.rethrow() | |
} | |
override def onUnavailable(statement: Statement, | |
cl: ConsistencyLevel, | |
requiredReplica: Int, | |
aliveReplica: Int, | |
nbRetry: Int): RetryDecision = { | |
if (nbRetry < maxRetries) RetryDecision.retry(cl) else RetryDecision.rethrow() | |
} | |
override def onWriteTimeout(statement: Statement, | |
cl: ConsistencyLevel, | |
writeType: WriteType, | |
requiredAcks: Int, | |
receivedAcks: Int, | |
nbRetry: Int): RetryDecision = { | |
if (nbRetry < maxRetries) RetryDecision.retry(cl) else RetryDecision.rethrow() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment