public static synchronized Unsafe get() {
        if (unsafe == null && !failed) {
            for (Field field : UNSAFE_CLASS.getDeclaredFields()) {
                if (!field.getType().equals(UNSAFE_CLASS) || !Modifier
                        .isStatic(field.getModifiers())) {
                    continue;
                }

                try {
                    boolean previous = field.isAccessible();
                    field.setAccessible(true);
                    unsafe = (Unsafe) field.get(null);
                    field.setAccessible(previous);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

            if (unsafe == null) {
                failed = true;
            }
        }

        return unsafe;
    }