You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Alexander Zobkov (JIRA)" <ji...@apache.org> on 2010/03/02 10:23:44 UTC

[jira] Updated: (SM-1937) Incorrect logic in throttle method of DeliveryChannelImpl.java

     [ https://issues.apache.org/activemq/browse/SM-1937?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Zobkov updated SM-1937:
---------------------------------

        Fix Version/s:     (was: 3.3)
    Affects Version/s: 3.3

> Incorrect logic in throttle method of DeliveryChannelImpl.java 
> ---------------------------------------------------------------
>
>                 Key: SM-1937
>                 URL: https://issues.apache.org/activemq/browse/SM-1937
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-core
>    Affects Versions: 3.3
>            Reporter: Alexander Zobkov
>            Priority: Minor
>
> It seems something wrong with logic of the following method in DeliveryChannelImpl.java  file:
> {code}
>     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++;
>         }
>     }
> {code}
> if user specifies positive values (default value is 1) of throttlingInterval then "if" statement is always true.  So user need to specify negative values of throttlingInterval in order to not force thread sleep on each doSend method. Also it would be good to add a little bit logging here. So I propose the following modification:
> {code}
>     protected void throttle() {
>         if (component.isExchangeThrottling()) {
>             if (component.getThrottlingInterval() < intervalCount) {
>                 intervalCount = 0;
>                 try {
>                     long timeout = component.getThrottlingTimeout()
>                     LOG.debug("throttling, sleep for: "+timeout);
>                     Thread.sleep(timeout);
>                 } catch (InterruptedException e) {
>                     LOG.warn("throttling failed", e);
>                 }
>             }
>             intervalCount++;
>         }
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.