jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Static Public Member Functions | Protected Member Functions | List of all members
org.jau.lang.UnsafeUtil Class Reference

Utility methods allowing easy access to certain sun.misc.Unsafe functionality. More...

Collaboration diagram for org.jau.lang.UnsafeUtil:

Static Public Member Functions

static boolean hasInvokeCleaner ()
 Returns true if sun.misc.Unsafe.invokeCleaner(java.nio.ByteBuffer) is available and has not caused an exception. More...
 
static boolean invokeCleaner (final ByteBuffer bb)
 Access to sun.misc.Unsafe.invokeCleaner(java.nio.ByteBuffer). More...
 
static boolean hasIllegalAccessLoggerAccess ()
 Returns true if access to jdk.internal.module.IllegalAcessLogger's logger field is available and has not caused an exception. More...
 
static< T > T doWithoutIllegalAccessLogger (final PrivilegedAction< T > action) throws RuntimeException
 Issue the given user action while jdk.internal.module.IllegalAcessLogger's logger has been temporarily disabled. More...
 

Protected Member Functions

 UnsafeUtil ()
 

Detailed Description

Utility methods allowing easy access to certain sun.misc.Unsafe functionality.

Definition at line 41 of file UnsafeUtil.java.

Constructor & Destructor Documentation

◆ UnsafeUtil()

org.jau.lang.UnsafeUtil.UnsafeUtil ( )
protected

Definition at line 48 of file UnsafeUtil.java.

Member Function Documentation

◆ doWithoutIllegalAccessLogger()

static< T > T org.jau.lang.UnsafeUtil.doWithoutIllegalAccessLogger ( final PrivilegedAction< T >  action) throws RuntimeException
static

Issue the given user action while jdk.internal.module.IllegalAcessLogger's logger has been temporarily disabled.

The caller shall place this call into their own AccessController#doPrivileged(PrivilegedAction) block.

In case the runtime is not PlatformProps#JAVA_9 or the logger is not accessible or disabling caused an exception, the user action is just executed w/o temporary logger modifications.

Parameters
actionthe user action task
Exceptions
RuntimeExceptionis thrown for a caught Throwable while executing the user action
See also
hasIllegalAccessLoggerAccess()

Definition at line 181 of file UnsafeUtil.java.

Here is the call graph for this function:

◆ hasIllegalAccessLoggerAccess()

static boolean org.jau.lang.UnsafeUtil.hasIllegalAccessLoggerAccess ( )
static

Returns true if access to jdk.internal.module.IllegalAcessLogger's logger field is available and has not caused an exception.

See also
#doWithoutIllegalAccessLogger(PrivilegedAction)

Definition at line 166 of file UnsafeUtil.java.

◆ hasInvokeCleaner()

static boolean org.jau.lang.UnsafeUtil.hasInvokeCleaner ( )
static

Returns true if sun.misc.Unsafe.invokeCleaner(java.nio.ByteBuffer) is available and has not caused an exception.

See also
invokeCleaner(ByteBuffer)

Definition at line 134 of file UnsafeUtil.java.

◆ invokeCleaner()

static boolean org.jau.lang.UnsafeUtil.invokeCleaner ( final ByteBuffer  bb)
static

Access to sun.misc.Unsafe.invokeCleaner(java.nio.ByteBuffer).

If b is an direct NIO buffer, i.e sun.nio.ch.DirectBuffer, calls it's sun.misc.Cleaner instance clean() method once.

Returns
true if successful, otherwise false.
See also
hasInvokeCleaner()

Definition at line 145 of file UnsafeUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: