Top Description Fields Constructors Methods
io.netty.util.internal.shaded.org.jctools.util

public Class UnsafeAccess

extends Object
Class Inheritance
Annotations
@InternalAPI
Imports
sun.misc.Unsafe, java.lang.reflect.Constructor, .Field, java.util.concurrent.atomic.AtomicReferenceArray, .AtomicReferenceFieldUpdater

Why should we resort to using Unsafe?
  1. To construct class fields which allow volatile/ordered/plain access: This requirement is covered by AtomicReferenceFieldUpdater and similar but their performance is arguably worse than the DIY approach (depending on JVM version) while Unsafe intrinsification is a far lesser challenge for JIT compilers.
  2. To construct flavors of AtomicReferenceArray.
  3. Other use cases exist but are not present in this library yet.
Author
nitsanw

Field Summary

Modifier and TypeField and Description
public static final boolean
public static final boolean
public static final Unsafe

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static long
fieldOffset(Class<T> clz, String fieldName)

private static Unsafe
private static boolean
private static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

SUPPORTS_GET_AND_ADD_LONGback to summary
public static final boolean SUPPORTS_GET_AND_ADD_LONG
SUPPORTS_GET_AND_SET_REFback to summary
public static final boolean SUPPORTS_GET_AND_SET_REF
UNSAFEback to summary
public static final Unsafe UNSAFE

Constructor Detail

UnsafeAccessback to summary
public UnsafeAccess()

Method Detail

fieldOffsetback to summary
public static long fieldOffset(Class<T> clz, String fieldName) throws RuntimeException
getUnsafeback to summary
private static Unsafe getUnsafe()
hasGetAndAddLongSupportback to summary
private static boolean hasGetAndAddLongSupport()
hasGetAndSetSupportback to summary
private static boolean hasGetAndSetSupport()