Skip to content
Snippets Groups Projects
UnsafeAccess.java 455 B
Newer Older
Christian Wulf's avatar
Christian Wulf committed
package teetime.util.concurrent.spsc;

import java.lang.reflect.Field;

import sun.misc.Unsafe;

@SuppressWarnings("restriction")
class UnsafeAccess {

	public static final Unsafe UNSAFE;

	static {
		try {
			Field field = Unsafe.class.getDeclaredField("theUnsafe");
			field.setAccessible(true);
			UNSAFE = (Unsafe) field.get(null);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	private UnsafeAccess() {
		// utility class
	}

}