@InterfaceAudience.Private public class BoundedByteBufferPool extends Object
The intended use case is a reservoir of bytebuffers that an RPC can reuse; buffers tend to achieve a particular 'run' size over time give or take a few extremes. Set TRACE level on this class for a couple of seconds to get reporting on how it is running when deployed.
This class is thread safe.
Constructor and Description |
---|
BoundedByteBufferPool(int maxByteBufferSizeToCache,
int initialByteBufferSize,
int maxToCache,
boolean createDirectByteBuffer) |
public BoundedByteBufferPool(int maxByteBufferSizeToCache, int initialByteBufferSize, int maxToCache, boolean createDirectByteBuffer)
maxByteBufferSizeToCache
- initialByteBufferSize
- maxToCache
- createDirectByteBuffer
- whether the buffers created by this pool to be off heappublic ByteBuffer getBuffer()
public void putBuffer(ByteBuffer bb)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.