public abstract class UnsafeHolder extends Object
hasUnsafe() returns true;| Modifier and Type | Class and Description |
|---|---|
static class |
UnsafeHolder.FreeMemory |
static interface |
UnsafeHolder.FreeMemoryFactory |
| Modifier and Type | Method and Description |
|---|---|
static ByteBuffer |
allocateDirectBuffer(int size,
UnsafeHolder.FreeMemoryFactory factory) |
static void |
changeDirectBufferCleaner(ByteBuffer buffer,
int size,
Class<? extends UnsafeHolder.FreeMemory> from,
Class<? extends UnsafeHolder.FreeMemory> to,
UnsafeHolder.FreeMemoryFactory factory,
java.util.function.Consumer<String> changeOwner)
Change the runnable field of Cleaner using given factory.
|
static void |
checkBounds(int arrayLength,
int offset,
int len)
Checks that the range described by
offset and size
doesn't exceed arrayLength. |
static int |
getAllocationSize(int size) |
static long |
getDirectBufferAddress(ByteBuffer buffer) |
static sun.misc.Unsafe |
getUnsafe() |
static boolean |
hasUnsafe() |
static InputStreamChannel |
newChannelBufferFramedInputStream(ReadableByteChannel channel,
int bufferSize) |
static OutputStreamChannel |
newChannelBufferFramedOutputStream(WritableByteChannel channel,
int bufferSize) |
static InputStreamChannel |
newChannelBufferInputStream(ReadableByteChannel channel,
int bufferSize) |
static OutputStreamChannel |
newChannelBufferOutputStream(WritableByteChannel channel,
int bufferSize) |
static ByteBuffer |
reallocateDirectBuffer(ByteBuffer buffer,
int newSize,
Class<?> expectedClass,
UnsafeHolder.FreeMemoryFactory factory) |
static void |
releaseIfDirectBuffer(ByteBuffer buffer)
Release explicitly if the passed ByteBuffer is a direct one.
|
static void |
releasePendingReferences() |
public static boolean hasUnsafe()
public static int getAllocationSize(int size)
public static ByteBuffer allocateDirectBuffer(int size, UnsafeHolder.FreeMemoryFactory factory)
public static long getDirectBufferAddress(ByteBuffer buffer)
public static ByteBuffer reallocateDirectBuffer(ByteBuffer buffer, int newSize, Class<?> expectedClass, UnsafeHolder.FreeMemoryFactory factory)
public static void changeDirectBufferCleaner(ByteBuffer buffer, int size, Class<? extends UnsafeHolder.FreeMemory> from, Class<? extends UnsafeHolder.FreeMemory> to, UnsafeHolder.FreeMemoryFactory factory, java.util.function.Consumer<String> changeOwner) throws IllegalAccessException
The provided Consumer is used to apply any action before actually
changing the runnable field with the boolean argument indicating whether
the current field matches "from" or if it is something else.
IllegalAccessExceptionpublic static void releaseIfDirectBuffer(ByteBuffer buffer)
public static void releasePendingReferences()
public static sun.misc.Unsafe getUnsafe()
public static InputStreamChannel newChannelBufferInputStream(ReadableByteChannel channel, int bufferSize) throws IOException
IOExceptionpublic static OutputStreamChannel newChannelBufferOutputStream(WritableByteChannel channel, int bufferSize) throws IOException
IOExceptionpublic static InputStreamChannel newChannelBufferFramedInputStream(ReadableByteChannel channel, int bufferSize) throws IOException
IOExceptionpublic static OutputStreamChannel newChannelBufferFramedOutputStream(WritableByteChannel channel, int bufferSize) throws IOException
IOExceptionpublic static void checkBounds(int arrayLength,
int offset,
int len)
offset and size
doesn't exceed arrayLength.Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.