Top Fields Constructors Methods
io.rsocket.internal.jctools.queues

pack-priv final Class UnsafeRefArrayAccess

extends Object
Class Inheritance
Static Imports
io.rsocket.internal.jctools.queues.UnsafeAccess.UNSAFE

Field Summary

Modifier and TypeField and Description
public static final long
public static final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static <E> E[]
allocateRefArray(int capacity)

This makes for an easier time generating the atomic queues, and removes some warnings.

public static long

Returns:

the offset in bytes within the circular array for a given index
calcCircularRefElementOffset
(long
desirable element index
index
,
long
(length - 1)
mask
)

Note

circular arrays are assumed a power of 2 in length and the `mask` is (length - 1).

public static long

Returns:

the offset in bytes within the array for a given index
calcRefElementOffset
(long
desirable element index
index
)

public static <E> E

Returns:

the element at the offset
lpRefElement
(E[]
this.buffer
buffer
,
long offset)

A plain load (no ordering/fences) of an element from a given offset.

public static <E> E

Returns:

the element at the offset
lvRefElement
(E[]
this.buffer
buffer
,
long offset)

A volatile load of an element from a given offset.

public static <E> void
soRefElement(E[]
this.buffer
buffer
,
long offset, E
an orderly kitty
e
)

An ordered store of an element to a given offset

public static <E> void
spRefElement(E[]
this.buffer
buffer
,
long offset, E
an orderly kitty
e
)

A plain store (no ordering/fences) of an element to a given offset

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

REF_ARRAY_BASEback to summary
public static final long REF_ARRAY_BASE
REF_ELEMENT_SHIFTback to summary
public static final int REF_ELEMENT_SHIFT

Constructor Detail

UnsafeRefArrayAccessback to summary
pack-priv UnsafeRefArrayAccess()

Method Detail

allocateRefArrayback to summary
public static <E> E[] allocateRefArray(int capacity)

This makes for an easier time generating the atomic queues, and removes some warnings.

Annotations
@SuppressWarnings:unchecked
calcCircularRefElementOffsetback to summary
public static long calcCircularRefElementOffset(long index, long mask)

Note

circular arrays are assumed a power of 2 in length and the `mask` is (length - 1).

Parameters
index:long

desirable element index

mask:long

(length - 1)

Returns:long

the offset in bytes within the circular array for a given index

calcRefElementOffsetback to summary
public static long calcRefElementOffset(long index)
Parameters
index:long

desirable element index

Returns:long

the offset in bytes within the array for a given index

lpRefElementback to summary
public static <E> E lpRefElement(E[] buffer, long offset)

A plain load (no ordering/fences) of an element from a given offset.

Parameters
buffer:E[]

this.buffer

offset:long

computed via UnsafeRefArrayAccess#calcRefElementOffset(long)

Returns:E

the element at the offset

Annotations
@SuppressWarnings:unchecked
lvRefElementback to summary
public static <E> E lvRefElement(E[] buffer, long offset)

A volatile load of an element from a given offset.

Parameters
buffer:E[]

this.buffer

offset:long

computed via UnsafeRefArrayAccess#calcRefElementOffset(long)

Returns:E

the element at the offset

Annotations
@SuppressWarnings:unchecked
soRefElementback to summary
public static <E> void soRefElement(E[] buffer, long offset, E e)

An ordered store of an element to a given offset

Parameters
buffer:E[]

this.buffer

offset:long

computed via UnsafeRefArrayAccess#calcCircularRefElementOffset

e:E

an orderly kitty

spRefElementback to summary
public static <E> void spRefElement(E[] buffer, long offset, E e)

A plain store (no ordering/fences) of an element to a given offset

Parameters
buffer:E[]

this.buffer

offset:long

computed via UnsafeRefArrayAccess#calcRefElementOffset(long)

e:E

an orderly kitty