| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface | |
| pack-priv class | |
| pack-priv static class | |
| pack-priv static class | |
| public static class | ByteBufferPool.
A set of buffer pools for each size, which can either be |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| private final ByteBufferPool. | |
| private final boolean | |
| public static final ByteBufferPool | LARGE_DIRECT
The large direct buffer pool. |
| public static final ByteBufferPool | LARGE_HEAP
The large heap buffer pool. |
| public static final int | LARGE_SIZE
The size of large buffers. |
| private final ConcurrentLinkedQueue | |
| public static final ByteBufferPool | MEDIUM_DIRECT
The medium direct buffer pool. |
| public static final ByteBufferPool | MEDIUM_HEAP
The medium heap buffer pool. |
| public static final int | MEDIUM_SIZE
The size of medium buffers. |
| private final int | |
| private static final boolean | |
| public static final ByteBufferPool | SMALL_DIRECT
The small direct buffer pool. |
| public static final ByteBufferPool | SMALL_HEAP
The small heap buffer pool. |
| public static final int | SMALL_SIZE
The size of small buffers. |
| private final ThreadLocal |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public < the type of the first parameter T, the type of the second parameter U, the exception type thrown by the operation E extends Exception> void | acceptWithCacheEx(int
the cache size to run under cacheSize, ExceptionBiConsumer<T, U, E> the action to run consumer, T the first parameter to pass to the action param1, U the second parameter to pass to the action param2)Perform the given operation with the addition of a buffer cache of the given size. |
| public < the type of the parameter T, the exception type thrown by the operation E extends Exception> void | acceptWithCacheEx(int
the cache size to run under cacheSize, ExceptionConsumer<T, E> the action to run consumer, T the parameter to pass to the action param)Perform the given operation with the addition of a buffer cache of the given size. |
| public ByteBuffer | |
| public void | allocate(ByteBuffer[]
the array of buffers to fill array, int the offset into the array to fill offs)Bulk-allocate buffers from this pool. |
| public void | allocate(ByteBuffer[]
the array of buffers to fill array, int the offset into the array to fill offs, int the number of buffers to fill in the array len)Bulk-allocate buffers from this pool. |
| private ByteBuffer | |
| public < the type of the first parameter T, the type of the second parameter U, the return type of the operation R, the exception type thrown by the operation E extends Exception> R | Returns: the result of the actionthe cache size to run under cacheSize, ExceptionBiFunction<T, U, R, E> the action to run function, T the first parameter to pass to the action param1, U the second parameter to pass to the action param2)Perform the given operation with the addition of a buffer cache of the given size. |
| public < the type of the parameter T, the return type of the operation R, the exception type thrown by the operation E extends Exception> R | Returns: the result of the actionthe cache size to run under cacheSize, ExceptionFunction<T, R, E> the action to run function, T the parameter to pass to the action param)Perform the given operation with the addition of a buffer cache of the given size. |
| pack-priv static ByteBufferPool | |
| pack-priv abstract ByteBuffer | |
| pack-priv final void | |
| public static void | |
| public void | |
| public static void | |
| public static void | free(ByteBuffer[]
the buffer array array, int the offset into the array offs, int the number of buffers to free len)Bulk-free buffers from an array as with |
| pack-priv final void | |
| pack-priv ByteBufferPool. | |
| pack-priv ConcurrentLinkedQueue | |
| public int | Returns: the size of buffers returned by this sourceGet the size of buffers returned by this source. |
| public < the return type of the operation R, the exception type thrown by the operation E extends Exception> R | Returns: the result of the actionthe cache size to run under cacheSize, ExceptionSupplier<R, E> the action to run supplier)Perform the given operation with the addition of a buffer cache of the given size. |
| public boolean | Returns: true if the buffers are direct, false if they are heapDetermine if this source returns direct buffers. |
| public void | runWithCache(int
the cache size to run under cacheSize, Runnable the action to run runnable)Perform the given operation with the addition of a buffer cache of the given size. |
| public < the exception type thrown by the operation E extends Exception> void | runWithCacheEx(int
the cache size to run under cacheSize, ExceptionRunnable<E> the action to run runnable)Perform the given operation with the addition of a buffer cache of the given size. |
| pack-priv static ByteBufferPool | |
| public static void | zeroAndFree(ByteBuffer
the buffer to free buffer)Free a buffer as with |
| CACHE_LINE_SIZE | back to summary |
|---|---|
| pack-priv static final int CACHE_LINE_SIZE | |
| defaultCache | back to summary |
|---|---|
| private final ByteBufferPool. | |
| direct | back to summary |
|---|---|
| private final boolean direct | |
| LARGE_DIRECT | back to summary |
|---|---|
| public static final ByteBufferPool LARGE_DIRECT The large direct buffer pool. This pool produces buffers of | |
| LARGE_HEAP | back to summary |
|---|---|
| public static final ByteBufferPool LARGE_HEAP The large heap buffer pool. This pool produces buffers of | |
| LARGE_SIZE | back to summary |
|---|---|
| public static final int LARGE_SIZE The size of large buffers. | |
| masterQueue | back to summary |
|---|---|
| private final ConcurrentLinkedQueue<ByteBuffer> masterQueue | |
| MEDIUM_DIRECT | back to summary |
|---|---|
| public static final ByteBufferPool MEDIUM_DIRECT The medium direct buffer pool. This pool produces buffers of | |
| MEDIUM_HEAP | back to summary |
|---|---|
| public static final ByteBufferPool MEDIUM_HEAP The medium heap buffer pool. This pool produces buffers of | |
| MEDIUM_SIZE | back to summary |
|---|---|
| public static final int MEDIUM_SIZE The size of medium buffers. | |
| size | back to summary |
|---|---|
| private final int size | |
| sliceLargeBuffers | back to summary |
|---|---|
| private static final boolean sliceLargeBuffers | |
| SMALL_DIRECT | back to summary |
|---|---|
| public static final ByteBufferPool SMALL_DIRECT The small direct buffer pool. This pool produces buffers of | |
| SMALL_HEAP | back to summary |
|---|---|
| public static final ByteBufferPool SMALL_HEAP The small heap buffer pool. This pool produces buffers of | |
| SMALL_SIZE | back to summary |
|---|---|
| public static final int SMALL_SIZE The size of small buffers. | |
| threadLocalCache | back to summary |
|---|---|
| private final ThreadLocal<ByteBufferPool. | |
| ByteBufferPool | back to summary |
|---|---|
| pack-priv ByteBufferPool(final int size, final boolean direct) | |
| acceptWithCacheEx | back to summary |
|---|---|
| public <T, U, E extends Exception> void acceptWithCacheEx(int cacheSize, ExceptionBiConsumer<T, U, E> consumer, T param1, U param2) throws ExceptionBiConsumer-T-U-:E Perform the given operation with the addition of a buffer cache of the given size. When this method returns, any cached free buffers will be returned to the next-higher cache or the global pool. If a cache size of 0 is given, the action is simply run directly.
| |
| acceptWithCacheEx | back to summary |
|---|---|
| public <T, E extends Exception> void acceptWithCacheEx(int cacheSize, ExceptionConsumer<T, E> consumer, T param) throws ExceptionConsumer-T-:E Perform the given operation with the addition of a buffer cache of the given size. When this method returns, any cached free buffers will be returned to the next-higher cache or the global pool. If a cache size of 0 is given, the action is simply run directly.
| |
| allocate | back to summary |
|---|---|
| public ByteBuffer allocate() Allocate a buffer from this source pool. The buffer must be freed through the
| |
| allocate | back to summary |
|---|---|
| public void allocate(ByteBuffer[] array, int offs) Bulk-allocate buffers from this pool. The buffer must be freed through the
| |
| allocate | back to summary |
|---|---|
| public void allocate(ByteBuffer[] array, int offs, int len) Bulk-allocate buffers from this pool. The buffer must be freed through the
| |
| allocateMaster | back to summary |
|---|---|
| private ByteBuffer allocateMaster() | |
| applyWithCacheEx | back to summary |
|---|---|
| public <T, U, R, E extends Exception> R applyWithCacheEx(int cacheSize, ExceptionBiFunction<T, U, R, E> function, T param1, U param2) throws ExceptionBiFunction-T-U-:E Perform the given operation with the addition of a buffer cache of the given size. When this method returns, any cached free buffers will be returned to the next-higher cache or the global pool. If a cache size of 0 is given, the action is simply run directly.
| |
| applyWithCacheEx | back to summary |
|---|---|
| public <T, R, E extends Exception> R applyWithCacheEx(int cacheSize, ExceptionFunction<T, R, E> function, T param) throws ExceptionFunction-T-:E Perform the given operation with the addition of a buffer cache of the given size. When this method returns, any cached free buffers will be returned to the next-higher cache or the global pool. If a cache size of 0 is given, the action is simply run directly.
| |
| create | back to summary |
|---|---|
| pack-priv static ByteBufferPool create(final int size, final boolean direct) | |
| createBuffer | back to summary |
|---|---|
| pack-priv abstract ByteBuffer createBuffer() | |
| doFree | back to summary |
|---|---|
| pack-priv final void doFree(final ByteBuffer buffer) | |
| flushAllCaches | back to summary |
|---|---|
| public static void flushAllCaches() Flush all thread-local caches for all buffer sizes. This is useful when a long blocking operation is being performed, wherein it is unlikely that buffers will be used; calling this method makes any cached buffers available to other threads. | |
| flushCaches | back to summary |
|---|---|
| public void flushCaches() Flush thread-local caches. This is useful when a long blocking operation is being performed, wherein it is unlikely that buffers will be used; calling this method makes any cached buffers available to other threads. | |
| free | back to summary |
|---|---|
| public static void free(ByteBuffer buffer) Free a buffer into its appropriate pool based on its size. Care must be taken to avoid returning a slice of a pooled buffer, since this could cause both the buffer and its slice to be separately repooled, leading to likely data corruption.
| |
| free | back to summary |
|---|---|
| public static void free(ByteBuffer[] array, int offs, int len) Bulk-free buffers from an array as with
| |
| freeMaster | back to summary |
|---|---|
| pack-priv final void freeMaster(ByteBuffer buffer) | |
| getDefaultCache | back to summary |
|---|---|
| pack-priv ByteBufferPool. | |
| getMasterQueue | back to summary |
|---|---|
| pack-priv ConcurrentLinkedQueue | |
| getSize | back to summary |
|---|---|
| public int getSize() Get the size of buffers returned by this source. The size will be a power of two.
| |
| getWithCacheEx | back to summary |
|---|---|
| public <R, E extends Exception> R getWithCacheEx(int cacheSize, ExceptionSupplier<R, E> supplier) throws ExceptionSupplier-:E Perform the given operation with the addition of a buffer cache of the given size. When this method returns, any cached free buffers will be returned to the next-higher cache or the global pool. If a cache size of 0 is given, the action is simply run directly.
| |
| isDirect | back to summary |
|---|---|
| public boolean isDirect() Determine if this source returns direct buffers.
| |
| runWithCache | back to summary |
|---|---|
| public void runWithCache(int cacheSize, Runnable runnable) Perform the given operation with the addition of a buffer cache of the given size. When this method returns, any cached free buffers will be returned to the next-higher cache or the global pool. If a cache size of 0 is given, the action is simply run directly.
| |
| runWithCacheEx | back to summary |
|---|---|
| public <E extends Exception> void runWithCacheEx(int cacheSize, ExceptionRunnable<E> runnable) throws ExceptionRunnable-:E Perform the given operation with the addition of a buffer cache of the given size. When this method returns, any cached free buffers will be returned to the next-higher cache or the global pool. If a cache size of 0 is given, the action is simply run directly.
| |
| subPool | back to summary |
|---|---|
| pack-priv static ByteBufferPool subPool(final ByteBufferPool parent, final int size) | |
| zeroAndFree | back to summary |
|---|---|
| public static void zeroAndFree(ByteBuffer buffer) Free a buffer as with
| |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | |
| public void | |
| public void | |
| public void | |
| public void |
| allocate | back to summary |
|---|---|
| public ByteBuffer allocate() | |
| destroy | back to summary |
|---|---|
| public void destroy() | |
| flush | back to summary |
|---|---|
| public void flush() | |
| flushBuffer | back to summary |
|---|---|
| public void flushBuffer(ByteBuffer bb) | |
| free | back to summary |
|---|---|
| public void free(ByteBuffer bb) | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | |
| public void | |
| public void | |
| public void | |
| public void |
| DefaultCache | back to summary |
|---|---|
| pack-priv DefaultCache() | |
| allocate | back to summary |
|---|---|
| public ByteBuffer allocate() Implements org. | |
| destroy | back to summary |
|---|---|
| public void destroy() Implements org. | |
| flush | back to summary |
|---|---|
| public void flush() Implements org. | |
| flushBuffer | back to summary |
|---|---|
| public void flushBuffer(final ByteBuffer bb) Implements org. | |
| free | back to summary |
|---|---|
| public void free(final ByteBuffer bb) Implements org. | |
| Modifier and Type | Field and Description |
|---|---|
| private long | |
| private final ByteBuffer[] | |
| private final long | |
| private final ByteBufferPool. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | |
| public void | |
| public void | |
| public void | |
| public void |
| availableBits | back to summary |
|---|---|
| private long availableBits | |
| cache | back to summary |
|---|---|
| private final ByteBuffer[] cache | |
| mask | back to summary |
|---|---|
| private final long mask | |
| parent | back to summary |
|---|---|
| private final ByteBufferPool. | |
| MultiCache | back to summary |
|---|---|
| pack-priv MultiCache(final ByteBufferPool. | |
| allocate | back to summary |
|---|---|
| public ByteBuffer allocate() Implements org. | |
| destroy | back to summary |
|---|---|
| public void destroy() Implements org. | |
| flush | back to summary |
|---|---|
| public void flush() Implements org. | |
| flushBuffer | back to summary |
|---|---|
| public void flushBuffer(final ByteBuffer bb) Implements org. | |
| free | back to summary |
|---|---|
| public void free(final ByteBuffer bb) Implements org. | |
| Modifier and Type | Field and Description |
|---|---|
| private ByteBuffer | |
| private final ByteBufferPool. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | |
| public void | |
| public void | |
| public void | |
| public void |
| buffer | back to summary |
|---|---|
| private ByteBuffer buffer | |
| parent | back to summary |
|---|---|
| private final ByteBufferPool. | |
| OneCache | back to summary |
|---|---|
| pack-priv OneCache(final ByteBufferPool. | |
| allocate | back to summary |
|---|---|
| public ByteBuffer allocate() Implements org. | |
| destroy | back to summary |
|---|---|
| public void destroy() Implements org. | |
| flush | back to summary |
|---|---|
| public void flush() Implements org. | |
| flushBuffer | back to summary |
|---|---|
| public void flushBuffer(final ByteBuffer bb) Implements org. | |
| free | back to summary |
|---|---|
| public void free(final ByteBuffer bb) Implements org. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final ByteBufferPool. | DIRECT
The direct buffer source set. |
| public static final ByteBufferPool. | HEAP
The heap buffer source set. |
| private final ByteBufferPool | |
| private final ByteBufferPool | |
| private final ByteBufferPool |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBufferPool | |
| public ByteBufferPool | |
| public ByteBufferPool |
| DIRECT | back to summary |
|---|---|
| public static final ByteBufferPool. The direct buffer source set. | |
| HEAP | back to summary |
|---|---|
| public static final ByteBufferPool. The heap buffer source set. | |
| large | back to summary |
|---|---|
| private final ByteBufferPool large | |
| normal | back to summary |
|---|---|
| private final ByteBufferPool normal | |
| small | back to summary |
|---|---|
| private final ByteBufferPool small | |
| Set | back to summary |
|---|---|
| pack-priv Set(final ByteBufferPool small, final ByteBufferPool normal, final ByteBufferPool large) | |
| getLarge | back to summary |
|---|---|
| public ByteBufferPool getLarge() Get the large buffer pool for this set.
| |
| getNormal | back to summary |
|---|---|
| public ByteBufferPool getNormal() Get the medium buffer pool for this set.
| |
| getSmall | back to summary |
|---|---|
| public ByteBufferPool getSmall() Get the small buffer pool for this set.
| |
| Modifier and Type | Field and Description |
|---|---|
| private ByteBuffer | |
| private ByteBuffer | |
| private final ByteBufferPool. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | |
| public void | |
| public void | |
| public void | |
| public void |
| buffer1 | back to summary |
|---|---|
| private ByteBuffer buffer1 | |
| buffer2 | back to summary |
|---|---|
| private ByteBuffer buffer2 | |
| parent | back to summary |
|---|---|
| private final ByteBufferPool. | |
| TwoCache | back to summary |
|---|---|
| pack-priv TwoCache(final ByteBufferPool. | |
| allocate | back to summary |
|---|---|
| public ByteBuffer allocate() Implements org. | |
| destroy | back to summary |
|---|---|
| public void destroy() Implements org. | |
| flush | back to summary |
|---|---|
| public void flush() Implements org. | |
| flushBuffer | back to summary |
|---|---|
| public void flushBuffer(final ByteBuffer bb) Implements org. | |
| free | back to summary |
|---|---|
| public void free(final ByteBuffer bb) Implements org. | |