https://issues.apache.org/bugzilla/show_bug.cgi?id=45753

--- Comment #9 from Ralph Goers <[email protected]> 2011-10-02 
19:52:01 UTC ---
If you've looked at the code you will see that it is using a DelayQueue to
control how many log entries can be written. From what I could tell in looking
at your code your bucket was essentially a bucket with a fixed window and you
remove x tokens every period making that the maximum that can be logged. With
the DelayQueue items will expire after the maxBurst period opening up slots for
that many new log events.  

To give an example, assuming I am understanding correctly, with your algorithm
with a window size of 100, an interval of 6 and an amount of 10 you would see a
maximum of 100 events in the first 6 seconds, 10 the next 6, 10 the next six,
etc.  With the implementation I've used you will see 100 events the first 6
seconds but what happens after that is a bit variable. Say the records arrived
as 10 the first second, 30 the second, 25 the third, 25 the fourth, 30 the
fifth (20 are ignored), and 25 in the last second (all of which are ignored)
then in the seventh second 10 new items would be allowed, 30 in the eighth, and
25 in the ninth, etc. It would be even more fluid than that since the
granularity of items in the queue is a nanosecond.  

So although you don't specify how many can be added after the queue has filled,
since the maximum number of items is specified and can never be exceeded and
since the queue is constantly emptying as items expire, I wouldn't think it
would be necessary to specify another number.  

By the way, yes I am using Junit for Log4j 2.0. I converted your test to log to
a ListAppender instead of the console and that was when I couldn't get it to
pass the tests. It may have been something I did wrong.

I should emphasize that I didn't add this to Log4j 1.2 as I'm solely focused on
building 2.0 and I thought this would make a nice addition. My version can't be
added to Log4j 1.2 as the DelayQueue requires Java 5.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to