APIdia Launch Partner
Top Fields Constructors Methods
com.sun.marlin

pack-priv final Class OffHeapArray

extends Object
Class Inheritance
Static Imports
com.sun.marlin.MarlinConst.LOG_OFF_HEAP_MALLOC

Field Summary

Modifier and TypeField and Description
private static final int
private Arena
private static final ValueLayout.OfByte
private final boolean
private static final ValueLayout.OfInt
private MemorySegment
pack-priv static final int
private int

Constructor Summary

AccessConstructor and Description
pack-priv
OffHeapArray(final Object
the object that will be used to register a cleaner to free the off-heap array when parent becomes phantom reachable; this is unused if the global arena is specified
parent
,
final long
the number of bytes to allocate
len
,
boolean
if true use the global arena, otherwise use a confined arena
global
)

Creates an OffHeapArray of the specified length using either the global arena or a confined arena.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
fill(final byte val)

pack-priv void
free()

pack-priv byte
getByte(long offset)

pack-priv int
getInt(long offset)

pack-priv long

Returns:

the length in bytes
getLength
()

Gets the length of this array.

pack-priv int

Returns:

number of used bytes
getUsed
()

Gets the number of bytes currently being used.

pack-priv void
incrementUsed(int
number of used bytes to increment
increment
)

Increments the number of bytes currently being used.

pack-priv void
putByte(long offset, byte val)

pack-priv void
putInt(long offset, int val)

pack-priv void
resize(final long len)

pack-priv void
setUsed(int
number of used bytes
used
)

Sets the number of bytes currently being used.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALIGNMENTback to summary
private static final int ALIGNMENT
arenaback to summary
private Arena arena
BYTE_LAYOUTback to summary
private static final ValueLayout.OfByte BYTE_LAYOUT
globalback to summary
private final boolean global
INT_LAYOUTback to summary
private static final ValueLayout.OfInt INT_LAYOUT
segmentback to summary
private MemorySegment segment
SIZE_INTback to summary
pack-priv static final int SIZE_INT
usedback to summary
private int used

Constructor Detail

OffHeapArrayback to summary
pack-priv OffHeapArray(final Object parent, final long len, boolean global)

Creates an OffHeapArray of the specified length using either the global arena or a confined arena. If the global arena is specified, the array may be accessed on any thread, but it must not be resized or freed. If a confined arena is specified, all access to this array must be done on the same thread that constructed it.

Parameters
parent:Object

the object that will be used to register a cleaner to free the off-heap array when parent becomes phantom reachable; this is unused if the global arena is specified

len:long

the number of bytes to allocate

global:boolean

if true use the global arena, otherwise use a confined arena

Method Detail

fillback to summary
pack-priv void fill(final byte val)
freeback to summary
pack-priv void free()
getByteback to summary
pack-priv byte getByte(long offset)
getIntback to summary
pack-priv int getInt(long offset)
getLengthback to summary
pack-priv long getLength()

Gets the length of this array.

Returns:long

the length in bytes

getUsedback to summary
pack-priv int getUsed()

Gets the number of bytes currently being used. Always <= length

Returns:int

number of used bytes

incrementUsedback to summary
pack-priv void incrementUsed(int increment)

Increments the number of bytes currently being used. Current used + increment must be <= length

Parameters
increment:int

number of used bytes to increment

putByteback to summary
pack-priv void putByte(long offset, byte val)
putIntback to summary
pack-priv void putInt(long offset, int val)
resizeback to summary
pack-priv void resize(final long len)
setUsedback to summary
pack-priv void setUsed(int used)

Sets the number of bytes currently being used. Always <= length

Parameters
used:int

number of used bytes