All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kilim.concurrent.UnsafeAccess Maven / Gradle / Ivy

Go to download

Coroutines, continuations, fibers, actors and message passing for the JVM

There is a newer version: 2.0.2-jdk7
Show newest version
// Copyright 2014 by nilangshah - offered under the terms of the MIT License

package kilim.concurrent;

import java.lang.reflect.Field;

import sun.misc.Unsafe;

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy