Re: Concurrency-interest Digest, Vol 121, Issue 5

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: Concurrency-interest Digest, Vol 121, Issue 5

Sergey Fedoseenkov
May be it will be helpful.

On Wed, Feb 4, 2015 at 3:16 PM, <[hidden email]> wrote:

Date: Wed, 4 Feb 2015 13:46:08 +0400
From: Valentin Kovalenko <[hidden email]>
To: Martin Buchholz <[hidden email]>,      concurrency-interest
        <[hidden email]>
Subject: Re: [concurrency-interest] Fixed Rate Executor Service
        <CAO-wXwKBbanTbdTQznFuL9=1uoW=[hidden email]>
Content-Type: text/plain; charset="utf-8"

Thanks! I've already found RateLimiter but unfortunately it doesn't check
if the rate is actually satisfied.

On Wed, Feb 4, 2015 at 6:02 AM, Martin Buchholz <[hidden email]> wrote:

> See also Guava RateLimiter
> On Tue, Feb 3, 2015 at 3:45 PM, Valentin Kovalenko <
> [hidden email]> wrote:
>> Hi
>> I'm looking for a fixed rate executor service, and would be glad if
>> someone could give me a hint.
>> I'm aware of j.u.c.ScheduledExecutorService.scheduleAtFixedRate, but this
>> method doesn't guarantees that actual rate will be not less that the
>> desired one: "If any execution of this task takes longer than its period,
>> then subsequent executions may start late".
>> What I want is something like
>> scheduleAtFixedRate(Runnable action, long rate, TimeUnit unit,
>> FailedRatePolicy frp),
>> where rate==10_000L and unit==SECONDS means 10_000 actions/second,
>> and FailedRatePolicy determines what to do if during some second executor
>> failed to satisfy the specified rate (i.e. if at that second it had
>> completed 6_000 actions). Examples of FailedRatePolicy: silently ignore;
>> log a warning; throw an exception. Note also that at the next second after
>> the second where rate wasn't satisfied executor doesn't try to execute
>> 10_000 actions plus those actions that weren't executed, it tries to
>> execute exactly 10_000 actions during the new second.
>> Does anyone know an executor which have such a functionality?

Concurrency-interest mailing list
[hidden email]