You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chukwa.apache.org by Luangsay Sourygna <lu...@gmail.com> on 2012/12/14 21:16:30 UTC

agent: doubt about sleeping condition in FileTailer.java

Hi,

In the run() method we have:
        if (timeToReadFiles < SAMPLE_PERIOD_MS || shouldISleep) {
          Thread.sleep(SAMPLE_PERIOD_MS);

If there is no more data to tail, we shall sleep 2 seconds. Fine.

But:
if we manage to tail files in less than 2 seconds, then we must wait 2 seconds.
Even if there is more data to tail???

Seems like it is a bug and the real condition should be:
(timeToReadFiles < SAMPLE_PERIOD_MS && shouldISleep).

Makes sense?

Sourygna

Re: agent: doubt about sleeping condition in FileTailer.java

Posted by Luangsay Sourygna <lu...@gmail.com>.
done:
https://issues.apache.org/jira/browse/CHUKWA-675

Re: agent: doubt about sleeping condition in FileTailer.java

Posted by Eric Yang <er...@gmail.com>.
Yes, you are right.  Mind submitting a patch?

regards,
Eric

On Fri, Dec 14, 2012 at 12:16 PM, Luangsay Sourygna <lu...@gmail.com>wrote:

> Hi,
>
> In the run() method we have:
>         if (timeToReadFiles < SAMPLE_PERIOD_MS || shouldISleep) {
>           Thread.sleep(SAMPLE_PERIOD_MS);
>
> If there is no more data to tail, we shall sleep 2 seconds. Fine.
>
> But:
> if we manage to tail files in less than 2 seconds, then we must wait 2
> seconds.
> Even if there is more data to tail???
>
> Seems like it is a bug and the real condition should be:
> (timeToReadFiles < SAMPLE_PERIOD_MS && shouldISleep).
>
> Makes sense?
>
> Sourygna
>