Package org.apache.cassandra.io.util
Class LimitingRebufferer
java.lang.Object
org.apache.cassandra.io.util.WrappingRebufferer
org.apache.cassandra.io.util.LimitingRebufferer
- All Implemented Interfaces:
AutoCloseable,ReaderFileProxy,Rebufferer,Rebufferer.BufferHolder
Rebufferer wrapper that applies rate limiting.
Instantiated once per RandomAccessReader, thread-unsafe.
The instances reuse themselves as the BufferHolder to avoid having to return a new object for each rebuffer call.
Only one BufferHolder can be active at a time. Calling rebuffer(long) before the previously obtained
buffer holder is released will throw AssertionError.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.cassandra.io.util.Rebufferer
Rebufferer.BufferHolder -
Field Summary
Fields inherited from class org.apache.cassandra.io.util.WrappingRebufferer
buffer, bufferHolder, offset, wrappedFields inherited from interface org.apache.cassandra.io.util.Rebufferer
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionLimitingRebufferer(Rebufferer wrapped, com.google.common.util.concurrent.RateLimiter limiter, int limitQuant) -
Method Summary
Methods inherited from class org.apache.cassandra.io.util.WrappingRebufferer
buffer, channel, close, closeReader, fileLength, getCrcCheckChance, offset, releaseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.cassandra.io.util.Rebufferer.BufferHolder
floatBuffer, intBuffer
-
Constructor Details
-
LimitingRebufferer
public LimitingRebufferer(Rebufferer wrapped, com.google.common.util.concurrent.RateLimiter limiter, int limitQuant)
-
-
Method Details
-
rebuffer
Description copied from interface:RebuffererRebuffer (move on or seek to) a given position, and return a buffer that can be used there. The only guarantee about the size of the returned data is that unless rebuffering at the end of the file, the buffer will not be empty and will contain the requested position, i.e.offset <= position < offset + bh.buffer().limit(), but the buffer will not be positioned there.- Specified by:
rebufferin interfaceRebufferer- Overrides:
rebufferin classWrappingRebufferer
-
toString
- Overrides:
toStringin classWrappingRebufferer
-