[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907149#action_12907149
 ] 

Ivan Kelly commented on ZOOKEEPER-831:
--------------------------------------

You've added a public method to the API purely for testing. Is this necessary? 
You can access the private members using reflection, which would save you 
having to add anything to the API which could be difficult to remove in the 
future.
 
@suppressWarning("unchecked")
int getAvailablePermits(LedgerHandle lh) {
    Field field = LedgerHandle.class.getDeclaredField("opCounterSem");
    field.setAccessible(true);
    return ((Semaphore)field.get(lh)).getAvailablePermits();
}


> BookKeeper: Throttling improved for reads
> -----------------------------------------
>
>                 Key: ZOOKEEPER-831
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-831
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bookkeeper
>    Affects Versions: 3.3.1
>            Reporter: Flavio Junqueira
>            Assignee: Flavio Junqueira
>             Fix For: 3.4.0
>
>         Attachments: ZOOKEEPER-831.patch, ZOOKEEPER-831.patch
>
>
> Reads and writes in BookKeeper are asymmetric: a write request writes one 
> entry, whereas a read request may read multiple requests. The current 
> implementation of throttling only counts the number of read requests instead 
> of counting the number of entries being read. Consequently, a few read 
> requests reading a large number of entries each will spawn a large number of 
> read-entry requests. 

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

Reply via email to