| Modifier and Type | Class and Description |
|---|---|
| private static class | Util.
A simple cache of direct buffers. |
| Modifier and Type | Field and Description |
|---|---|
| private static final TerminatingThreadLocal | |
| private static volatile Constructor | |
| private static volatile Constructor | |
| private static final long | |
| private static final JavaNioAccess | |
| private static int | |
| private static final int | |
| private static final Unsafe |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static byte | |
| private static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| private static void | |
| private static long | |
| public static ByteBuffer | getTemporaryAlignedDirectBuffer(int size, int alignment)
Returns a temporary buffer of at least the given size and aligned to the alignment |
| public static ByteBuffer | |
| private static void | |
| private static void | |
| private static boolean | isBufferTooLarge(int size)
Returns true if a buffer of this size is too large to be added to the buffer cache, false otherwise. |
| private static boolean | isBufferTooLarge(ByteBuffer buf)
Returns true if the buffer is too large to be added to the buffer cache, false otherwise. |
| pack-priv static MappedByteBuffer | |
| pack-priv static MappedByteBuffer | |
| pack-priv static void | offerFirstTemporaryDirectBuffer(ByteBuffer buf)
Releases a temporary buffer by returning to the cache or freeing it. |
| pack-priv static void | offerLastTemporaryDirectBuffer(ByteBuffer buf)
Releases a temporary buffer by returning to the cache or freeing it. |
| pack-priv static int | |
| public static void | releaseTemporaryDirectBuffer(ByteBuffer buf)
Releases a temporary buffer by returning to the cache or freeing it. |
| pack-priv static ByteBuffer[] | |
| pack-priv static <E> Set | |
| pack-priv static Unsafe | |
| private static ByteBuffer | unwrapIfAlignedSlice(ByteBuffer buf)
Return the underling byte buffer if the given byte buffer is an aligned slice. |
| bufferCache | back to summary |
|---|---|
| private static final TerminatingThreadLocal<Util. | |
| directByteBufferConstructor | back to summary |
|---|---|
| private static volatile Constructor<?> directByteBufferConstructor | |
| directByteBufferRConstructor | back to summary |
|---|---|
| private static volatile Constructor<?> directByteBufferRConstructor | |
| MAX_CACHED_BUFFER_SIZE | back to summary |
|---|---|
| private static final long MAX_CACHED_BUFFER_SIZE | |
| NIO_ACCESS | back to summary |
|---|---|
| private static final JavaNioAccess NIO_ACCESS | |
| pageSize | back to summary |
|---|---|
| private static int pageSize | |
| TEMP_BUF_POOL_SIZE | back to summary |
|---|---|
| private static final int TEMP_BUF_POOL_SIZE | |
| unsafe | back to summary |
|---|---|
| private static final Unsafe unsafe | |
| Util | back to summary |
|---|---|
| public Util() | |
| _get | back to summary |
|---|---|
| private static byte _get(long a) | |
| _put | back to summary |
|---|---|
| private static void _put(long a, byte b) | |
| checkBufferPositionAligned | back to summary |
|---|---|
| pack-priv static void checkBufferPositionAligned(ByteBuffer bb, int pos, int alignment) throws IOException | |
| checkChannelPositionAligned | back to summary |
|---|---|
| pack-priv static void checkChannelPositionAligned(long position, int alignment) throws IOException | |
| checkRemainingBufferSizeAligned | back to summary |
|---|---|
| pack-priv static void checkRemainingBufferSizeAligned(int rem, int alignment) throws IOException | |
| erase | back to summary |
|---|---|
| pack-priv static void erase(ByteBuffer bb) | |
| free | back to summary |
|---|---|
| private static void free(ByteBuffer buf) Frees the memory for the given direct buffer | |
| getMaxCachedBufferSize | back to summary |
|---|---|
| private static long getMaxCachedBufferSize() Returns the max size allowed for a cached temp buffers, in bytes. It defaults to Long.MAX_VALUE. It can be set with the jdk.nio.maxCachedBufferSize property. Even though ByteBuffer.capacity() returns an int, we're using a long here for potential future-proofing. | |
| getTemporaryAlignedDirectBuffer | back to summary |
|---|---|
| public static ByteBuffer getTemporaryAlignedDirectBuffer(int size, int alignment) Returns a temporary buffer of at least the given size and aligned to the alignment | |
| getTemporaryDirectBuffer | back to summary |
|---|---|
| public static ByteBuffer getTemporaryDirectBuffer(int size) Returns a temporary buffer of at least the given size | |
| initDBBConstructor | back to summary |
|---|---|
| private static void initDBBConstructor() | |
| initDBBRConstructor | back to summary |
|---|---|
| private static void initDBBRConstructor() | |
| isBufferTooLarge | back to summary |
|---|---|
| private static boolean isBufferTooLarge(int size) Returns true if a buffer of this size is too large to be added to the buffer cache, false otherwise. | |
| isBufferTooLarge | back to summary |
|---|---|
| private static boolean isBufferTooLarge(ByteBuffer buf) Returns true if the buffer is too large to be added to the buffer cache, false otherwise. | |
| newMappedByteBuffer | back to summary |
|---|---|
| pack-priv static MappedByteBuffer newMappedByteBuffer(int size, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync) | |
| newMappedByteBufferR | back to summary |
|---|---|
| pack-priv static MappedByteBuffer newMappedByteBufferR(int size, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync) | |
| offerFirstTemporaryDirectBuffer | back to summary |
|---|---|
| pack-priv static void offerFirstTemporaryDirectBuffer(ByteBuffer buf) Releases a temporary buffer by returning to the cache or freeing it. If returning to the cache then insert it at the start so that it is likely to be returned by a subsequent call to getTemporaryDirectBuffer. | |
| offerLastTemporaryDirectBuffer | back to summary |
|---|---|
| pack-priv static void offerLastTemporaryDirectBuffer(ByteBuffer buf) Releases a temporary buffer by returning to the cache or freeing it. If returning to the cache then insert it at the end. This makes it suitable for scatter/gather operations where the buffers are returned to cache in same order that they were obtained. | |
| pageSize | back to summary |
|---|---|
| pack-priv static int pageSize() | |
| releaseTemporaryDirectBuffer | back to summary |
|---|---|
| public static void releaseTemporaryDirectBuffer(ByteBuffer buf) Releases a temporary buffer by returning to the cache or freeing it. | |
| subsequence | back to summary |
|---|---|
| pack-priv static ByteBuffer[] subsequence(ByteBuffer[] bs, int offset, int length) | |
| ungrowableSet | back to summary |
|---|---|
| pack-priv static <E> Set | |
| unsafe | back to summary |
|---|---|
| pack-priv static Unsafe unsafe() | |
| unwrapIfAlignedSlice | back to summary |
|---|---|
| private static ByteBuffer unwrapIfAlignedSlice(ByteBuffer buf) Return the underling byte buffer if the given byte buffer is an aligned slice. | |
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBuffer[] | |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv ByteBuffer | get(int size)
Removes and returns a buffer from the cache of at least the given size (or null if no suitable buffer is found). |
| pack-priv boolean | |
| private int | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv ByteBuffer |
| buffers | back to summary |
|---|---|
| private final ByteBuffer[] buffers | |
| count | back to summary |
|---|---|
| private int count | |
| start | back to summary |
|---|---|
| private int start | |
| BufferCache | back to summary |
|---|---|
| pack-priv BufferCache() | |
| get | back to summary |
|---|---|
| pack-priv ByteBuffer get(int size) Removes and returns a buffer from the cache of at least the given size (or null if no suitable buffer is found). | |
| isEmpty | back to summary |
|---|---|
| pack-priv boolean isEmpty() | |
| next | back to summary |
|---|---|
| private int next(int i) | |
| offerFirst | back to summary |
|---|---|
| pack-priv boolean offerFirst(ByteBuffer buf) | |
| offerLast | back to summary |
|---|---|
| pack-priv boolean offerLast(ByteBuffer buf) | |
| removeFirst | back to summary |
|---|---|
| pack-priv ByteBuffer removeFirst() | |