[ 
https://issues.apache.org/jira/browse/LUCENE-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13099235#comment-13099235
 ] 

Simon Willnauer commented on LUCENE-3416:
-----------------------------------------

what about something like that:

{code}
  public void setMaxMergeWriteMBPerSec(Double mbPerSec) {
    final RateLimiter limiter = mergeWriteRateLimiter;
    if (mbPerSec == null) {
      if (limiter != null) {
        limiter.setMaxRate(Double.MAX_VALUE);
        mergeWriteRateLimiter = null;
      }
    } else if (limiter != null) {
      limiter.setMaxRate(mbPerSec);
    } else {
      mergeWriteRateLimiter = new RateLimiter(mbPerSec);
    }
  }

  /** See {@link #setMaxMergeWriteMBPerSec}.
   *
   * @lucene.experimental */
  public Double getMaxMergeWriteMBPerSec() {
    final RateLimiter limiter = mergeWriteRateLimiter;
    return limiter == null ? null : limiter.getMaxRateMB();
  }
{code}

I think we can make this simple without any synchronization which is totally 
unnecessary here.

> Allow to pass an instance of RateLimiter to FSDirectory allowing to rate 
> limit merge IO across several directories / instances
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3416
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3416
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/store
>            Reporter: Shay Banon
>            Assignee: Simon Willnauer
>         Attachments: LUCENE-3416.patch
>
>
> This can come in handy when running several Lucene indices in the same VM, 
> and wishing to rate limit merge across all of them.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to