读书人

Flume源代码解读4

发布时间: 2012-07-27 11:03:00 作者: rapoo

Flume源代码解读四

? ?[ xcly原创于iteye,见http://xcly.iteye.com?]

?

? ? 今天介绍Flume里面用到的BackoffAlgo算法,接口由BackoffPolicy定义,让我们看看下面的几个关键的方法

reset:Reset backoff state. Call this after successful attempts.每一次成功调用之后reset状态。

backoff:Modify state as if a backoff had just happened. Call this after failed?attempts。失败发生时调用的回退犯法。

isFailed:Has so much time passed that we assume the failure is irrecoverable? 如果返回true,不再尝试。

sleepIncrement:Wait time in millis until RetryOk should be true

waitUntilRetryOk:Wait until it's ok to retry.

?

? ? 在InsistentAppendDecorator,?InsistentOpenDecorator中调用了BackoffPolicy的子类CumulativeCappedExponentialBackoff,CumulativeCappedExponentialBackoff中的isfailed总是返回true,永远不会失败;总是不断尝试。

?

?

?

?

?

读书人网 >开源软件

热点推荐