Package com.jogamp.common.util
Class UnsafeUtil
- java.lang.Object
-
- com.jogamp.common.util.UnsafeUtil
-
public class UnsafeUtil extends Object
Utility methods allowing easy access to certainUnsafe
functionality.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
UnsafeUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
doWithoutIllegalAccessLogger(PrivilegedAction<T> action)
Issue the given useraction
whilejdk.internal.module.IllegalAcessLogger
'slogger
has been temporarily disabled.static boolean
hasIllegalAccessLoggerAccess()
Returnstrue
if access tojdk.internal.module.IllegalAcessLogger
'slogger
field is available and has not caused an exception.static boolean
hasInvokeCleaner()
Returnstrue
ifsun.misc.Unsafe.invokeCleaner(java.nio.ByteBuffer)
is available and has not caused an exception.static boolean
invokeCleaner(ByteBuffer bb)
Access tosun.misc.Unsafe.invokeCleaner(java.nio.ByteBuffer)
.
-
-
-
Method Detail
-
hasInvokeCleaner
public static boolean hasInvokeCleaner()
Returnstrue
ifsun.misc.Unsafe.invokeCleaner(java.nio.ByteBuffer)
is available and has not caused an exception.- See Also:
invokeCleaner(ByteBuffer)
-
invokeCleaner
public static boolean invokeCleaner(ByteBuffer bb)
Access tosun.misc.Unsafe.invokeCleaner(java.nio.ByteBuffer)
.If
b
is an direct NIO buffer, i.eDirectBuffer
, calls it'ssun.misc.Cleaner
instanceclean()
method once.- Returns:
true
if successful, otherwisefalse
.- See Also:
hasInvokeCleaner()
-
hasIllegalAccessLoggerAccess
public static boolean hasIllegalAccessLoggerAccess()
Returnstrue
if access tojdk.internal.module.IllegalAcessLogger
'slogger
field is available and has not caused an exception.
-
doWithoutIllegalAccessLogger
public static <T> T doWithoutIllegalAccessLogger(PrivilegedAction<T> action) throws RuntimeException
Issue the given useraction
whilejdk.internal.module.IllegalAcessLogger
'slogger
has been temporarily disabled.The caller shall place this call into their own
SecurityUtil.doPrivileged(PrivilegedAction)
block.In case the runtime is not
PlatformPropsImpl.JAVA_9
or the logger is not accessible or disabling caused an exception, the useraction
is just executed w/o temporary logger modifications.- Parameters:
action
- the user action task- Throws:
RuntimeException
- is thrown for a caughtThrowable
while executing the useraction
- See Also:
hasIllegalAccessLoggerAccess()
-
-