Skip to content

Commit

Permalink
Optional unsafe, v3.6.8
Browse files Browse the repository at this point in the history
  • Loading branch information
igr committed Feb 18, 2018
1 parent d160cd1 commit 77b84c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ description = '''
'''

//version = '3.7.0-20151107'
version = '3.6.7'
version = '3.6.8'

// --- properties -------------------------------------------------------------

Expand Down
18 changes: 16 additions & 2 deletions jodd-core/src/main/java/jodd/util/SystemUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,29 @@ public String run() {

// ---------------------------------------------------------------- unsafe

private static final boolean HAS_UNSAFE = hasUnsafe0();
private static boolean HAS_UNSAFE = hasUnsafe0();

/**
* Returns <code>true</code> if system has the <code>Unsafe</code>.
* Returns <code>true</code> if system has the <code>Unsafe</code> enabled.
*/
public static boolean hasUnsafe() {
return HAS_UNSAFE;
}

/**
* Disables usage of <code>Unsafe</code>.
*/
public static void disableUnsafeUsage() {
HAS_UNSAFE = false;
}

/**
* Enables usage of Unsafe, if system has it.
*/
public static void enableUnsafeUsage() {
HAS_UNSAFE = hasUnsafe0();
}

private static boolean hasUnsafe0() {
if (isHostAndroid()) {
return false;
Expand Down

0 comments on commit 77b84c2

Please sign in to comment.