org.apache.lucene.store

## Class RateLimiter.SimpleRateLimiter

- java.lang.Object
- - org.apache.lucene.store.RateLimiter
  - - org.apache.lucene.store.RateLimiter.SimpleRateLimiter

Enclosing class:
  RateLimiter

    public static class RateLimiter.SimpleRateLimiter
    extends RateLimiter

Simple class to rate limit IO.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.lucene.store.RateLimiter

`RateLimiter.SimpleRateLimiter`

### Constructor Summary

Constructors
Constructor and Description
`SimpleRateLimiter(double mbPerSec)` mbPerSec is the MB/sec max IO rate

### Method Summary

All Methods Instance Methods Concrete Methods
`double` `getMBPerSec()` The current mb per second rate limit.
`long` `getMinPauseCheckBytes()` How many bytes caller should add up itself before invoking `RateLimiter.pause(long)`.
`long` `pause(long bytes)` Pauses, if necessary, to keep the instantaneous IO rate at or below the target.
`void` `setMBPerSec(double mbPerSec)` Sets an updated mb per second rate limit.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SimpleRateLimiter

    public SimpleRateLimiter(double mbPerSec)

mbPerSec is the MB/sec max IO rate

### Method Detail

#### setMBPerSec

    public void setMBPerSec(double mbPerSec)

Sets an updated mb per second rate limit.

Specified by:
  `setMBPerSec` in class `RateLimiter`

#### getMinPauseCheckBytes

    public long getMinPauseCheckBytes()

Description copied from class: `RateLimiter`
How many bytes caller should add up itself before invoking `RateLimiter.pause(long)`.

Specified by:
  `getMinPauseCheckBytes` in class `RateLimiter`

#### getMBPerSec

    public double getMBPerSec()

The current mb per second rate limit.

Specified by:
  `getMBPerSec` in class `RateLimiter`

#### pause

    public long pause(long bytes)

Pauses, if necessary, to keep the instantaneous IO rate at or below the target. Be sure to only call this method when bytes > `getMinPauseCheckBytes()`, otherwise it will pause way too long!

Specified by:
  `pause` in class `RateLimiter`
Returns:
  the pause time in nano seconds