You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by bradtwurst <na...@xoxy.net> on 2007/03/22 12:03:14 UTC
How does throttling work
Good day to all,
I was looking at the component throttling logic and it seems to be backwards
to me. Can anyone confirm?
The current code is
> private int intervalCount = 0;
>
>
> protected void throttle() {
> if (component.isExchangeThrottling()) {
> if (component.getThrottlingInterval() > intervalCount) {
> intervalCount = 0;
> try {
> Thread.sleep(component.getThrottlingTimeout());
> }
> catch (InterruptedException e) {
> log.warn("throttling failed", e);
> }
> }
> intervalCount++;
> }
> }
>
>
It appears to me that, as long as the throttling interval is > 1, that every
call would be throttled. Shouldn't it be that the check should be if
intervalCount > throttling interval? Or am I just sleep deprived and not
thinking straight?
Thanks,
James
--
View this message in context: http://www.nabble.com/How-does-throttling-work-tf3446622s12049.html#a9611785
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
Re: How does throttling work
Posted by Guillaume Nodet <gn...@gmail.com>.
Yeah, good catch !
Could you please raise a JIRA and provide a fix ?
On 3/22/07, bradtwurst <na...@xoxy.net> wrote:
>
>
> Good day to all,
>
> I was looking at the component throttling logic and it seems to be
> backwards
> to me. Can anyone confirm?
>
> The current code is
>
>
>
> > private int intervalCount = 0;
> >
> >
> > protected void throttle() {
> > if (component.isExchangeThrottling()) {
> > if (component.getThrottlingInterval() > intervalCount) {
> > intervalCount = 0;
> > try {
> > Thread.sleep(component.getThrottlingTimeout());
> > }
> > catch (InterruptedException e) {
> > log.warn("throttling failed", e);
> > }
> > }
> > intervalCount++;
> > }
> > }
> >
> >
>
> It appears to me that, as long as the throttling interval is > 1, that
> every
> call would be throttled. Shouldn't it be that the check should be if
> intervalCount > throttling interval? Or am I just sleep deprived and not
> thinking straight?
>
> Thanks,
> James
> --
> View this message in context:
> http://www.nabble.com/How-does-throttling-work-tf3446622s12049.html#a9611785
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet
------------------------
Architect, LogicBlaze (http://www.logicblaze.com/)
Blog: http://gnodet.blogspot.com/