APIdia Launch Partner
Top Inners Fields Constructors Methods
jdk.internal.misc

public Class VM

extends Object
Class Inheritance
Static Imports
java.lang.Thread.State.*

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
VM.BufferPool

Provides access to information on buffer usage.

private static class

Field Summary

Modifier and TypeField and Description
private static long
private static volatile int
private static volatile int
private static final int
private static boolean
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final Object
private static final int
private static Boolean
private static volatile int
private static Map<String, String>
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
VM()

Method Summary

Modifier and TypeMethod and Description
public static void
public static void
awaitInitLevel(int value)

Waits for the init level to get the given value.

public static List<VM.BufferPool>
getBufferPools()

Returns: the list of buffer pools.

public static native long
getegid()

Returns the effective group ID of the calling process, or -1 if the value is not available.

public static native long
geteuid()

Returns the effective user ID of the calling process, or -1 if the value is not available.

public static int
public static native long
getgid()

Returns the real group ID of the calling process, or -1 if the value is not available.

public static native long

Returns:

A nanosecond time stamp adjustment in the form of a single long. If the offset is too far off the current time, this method returns -1. In that case, the caller should call this method again, passing a more accurate offset.
getNanoTimeAdjustment
(long
The offset in seconds from which the nanosecond time stamp should be computed.
offsetInSeconds
)

Get a nanosecond time stamp adjustment in the form of a single long.

public static int
public static native String[]
getRuntimeArguments()

Returns the VM arguments for this runtime environment.

public static Map<String, String>
getSavedProperties()

Gets an unmodifiable view of the system properties saved at system initialization time.

public static String
getSavedProperty(String key)

Returns the system property of the specified key saved at system initialization time.

public static native long
getuid()

Returns the real user ID of the calling process, or -1 if the value is not available.

public static PrintStream
initialErr()

Return the initial value of System.err that was set during VM initialization.

private static native void
public static void
public static void
initLevel(int value)

Sets the init level.

public static int
initLevel()

Returns the current init level.

public static boolean
isBooted()

Returns true if the VM is fully initialized.

public static boolean
public static boolean
public static boolean
isModuleSystemInited()

Returns true if the module system has been initialized.

public static boolean
isSetUID()

Returns true if we are in a set UID program.

public static boolean
isShutdown()

Returns true if the VM has been shutdown

public static boolean
isSupportedClassFileVersion(int major, int minor)

Tests if the given version is a supported class file version.

public static boolean
isSupportedModuleDescriptorVersion(int major, int minor)

Tests if the given version is a supported class file version for module descriptor.

public static boolean
isSystemDomainLoader(ClassLoader loader)

Returns true if the given class loader is the bootstrap class loader or the platform class loader.

public static ClassLoader
private static native ClassLoader
public static long
public static void
public static void
public static void
shutdown()

Set shutdown state.

public static Thread.State
toThreadState(int threadStatus)

Returns Thread.State for the given threadStatus

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

directMemoryback to summary
private static long directMemory
finalRefCountback to summary
private static volatile int finalRefCount
initLevelback to summary
private static volatile int initLevel
JAVA_LANG_SYSTEM_INITEDback to summary
private static final int JAVA_LANG_SYSTEM_INITED
javaLangInvokeInitedback to summary
private static boolean javaLangInvokeInited
Annotations
@Stable
JVMTI_THREAD_STATE_ALIVEback to summary
private static final int JVMTI_THREAD_STATE_ALIVE
JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTERback to summary
private static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER
JVMTI_THREAD_STATE_RUNNABLEback to summary
private static final int JVMTI_THREAD_STATE_RUNNABLE
JVMTI_THREAD_STATE_TERMINATEDback to summary
private static final int JVMTI_THREAD_STATE_TERMINATED
JVMTI_THREAD_STATE_WAITING_INDEFINITELYback to summary
private static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUTback to summary
private static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT
lockback to summary
private static final Object lock
MODULE_SYSTEM_INITEDback to summary
private static final int MODULE_SYSTEM_INITED
pageAlignDirectMemoryback to summary
private static Boolean pageAlignDirectMemory
Annotations
@Stable
peakFinalRefCountback to summary
private static volatile int peakFinalRefCount
savedPropsback to summary
private static Map<String, String> savedProps
SYSTEM_BOOTEDback to summary
private static final int SYSTEM_BOOTED
SYSTEM_LOADER_INITIALIZINGback to summary
private static final int SYSTEM_LOADER_INITIALIZING
SYSTEM_SHUTDOWNback to summary
private static final int SYSTEM_SHUTDOWN

Constructor Detail

VMback to summary
public VM()

Method Detail

addFinalRefCountback to summary
public static void addFinalRefCount(int n)
awaitInitLevelback to summary
public static void awaitInitLevel(int value) throws InterruptedException

Waits for the init level to get the given value.

getBufferPoolsback to summary
public static List<VM.BufferPool> getBufferPools()
Returns:List<VM.BufferPool>

the list of buffer pools.

getegidback to summary
public static native long getegid()

Returns the effective group ID of the calling process, or -1 if the value is not available.

geteuidback to summary
public static native long geteuid()

Returns the effective user ID of the calling process, or -1 if the value is not available.

getFinalRefCountback to summary
public static int getFinalRefCount()
getgidback to summary
public static native long getgid()

Returns the real group ID of the calling process, or -1 if the value is not available.

getNanoTimeAdjustmentback to summary
public static native long getNanoTimeAdjustment(long offsetInSeconds)

Get a nanosecond time stamp adjustment in the form of a single long. This value can be used to create an instant using java.time.Instant.ofEpochSecond(offsetInSeconds, getNanoTimeAdjustment(offsetInSeconds)).

The value returned has the best resolution available to the JVM on the current system. This is usually down to microseconds - or tenth of microseconds - depending on the OS/Hardware and the JVM implementation.

API Note

The offset should be recent enough - so that offsetInSeconds is within +/- 2^32 seconds of the current UTC time. If the offset is too far off, -1 will be returned. As such, -1 must not be considered as a valid nano time adjustment, but as an exception value indicating that an offset closer to the current time should be used.

Parameters
offsetInSeconds:long

The offset in seconds from which the nanosecond time stamp should be computed.

Returns:long

A nanosecond time stamp adjustment in the form of a single long. If the offset is too far off the current time, this method returns -1. In that case, the caller should call this method again, passing a more accurate offset.

getPeakFinalRefCountback to summary
public static int getPeakFinalRefCount()
getRuntimeArgumentsback to summary
public static native String[] getRuntimeArguments()

Returns the VM arguments for this runtime environment.

Implementation Note

The HotSpot JVM processes the input arguments from multiple sources in the following order: 1. JAVA_TOOL_OPTIONS environment variable 2. Options from JNI Invocation API 3. _JAVA_OPTIONS environment variable If VM options file is specified via -XX:VMOptionsFile, the vm options file is read and expanded in place of -XX:VMOptionFile option.

getSavedPropertiesback to summary
public static Map<String, String> getSavedProperties()

Gets an unmodifiable view of the system properties saved at system initialization time. This method should only be used for the system properties that are not changed during runtime. Note that the saved system properties do not include the ones set by java.lang.VersionProps.init().

getSavedPropertyback to summary
public static String getSavedProperty(String key)

Returns the system property of the specified key saved at system initialization time. This method should only be used for the system properties that are not changed during runtime. Note that the saved system properties do not include the ones set by java.lang.VersionProps.init().

getuidback to summary
public static native long getuid()

Returns the real user ID of the calling process, or -1 if the value is not available.

initialErrback to summary
public static PrintStream initialErr()

Return the initial value of System.err that was set during VM initialization.

initializeback to summary
private static native void initialize()
initializeOSEnvironmentback to summary
public static void initializeOSEnvironment()
initLevelback to summary
public static void initLevel(int value)

Sets the init level.

See Also
java.lang.System#initPhase1, java.lang.System#initPhase2, java.lang.System#initPhase3
initLevelback to summary
public static int initLevel()

Returns the current init level.

isBootedback to summary
public static boolean isBooted()

Returns true if the VM is fully initialized.

isDirectMemoryPageAlignedback to summary
public static boolean isDirectMemoryPageAligned()
isJavaLangInvokeInitedback to summary
public static boolean isJavaLangInvokeInited()
isModuleSystemInitedback to summary
public static boolean isModuleSystemInited()

Returns true if the module system has been initialized.

See Also
java.lang.System#initPhase2
isSetUIDback to summary
public static boolean isSetUID()

Returns true if we are in a set UID program.

isShutdownback to summary
public static boolean isShutdown()

Returns true if the VM has been shutdown

isSupportedClassFileVersionback to summary
public static boolean isSupportedClassFileVersion(int major, int minor)

Tests if the given version is a supported class file version. A class file depends on the preview features of Java SE N if the major version is N and the minor version is 65535. This method returns true if the given version is a supported class file version regardless of whether the preview features are enabled or not.

Java Virtual Machine Specification
4.1 Table 4.1-A. class file format major versions
isSupportedModuleDescriptorVersionback to summary
public static boolean isSupportedModuleDescriptorVersion(int major, int minor)

Tests if the given version is a supported class file version for module descriptor. major.minor version >= 53.0

isSystemDomainLoaderback to summary
public static boolean isSystemDomainLoader(ClassLoader loader)

Returns true if the given class loader is the bootstrap class loader or the platform class loader.

latestUserDefinedLoaderback to summary
public static ClassLoader latestUserDefinedLoader()
latestUserDefinedLoader0back to summary
private static native ClassLoader latestUserDefinedLoader0()
maxDirectMemoryback to summary
public static long maxDirectMemory()
savePropertiesback to summary
public static void saveProperties(Map<String, String> props)
setJavaLangInvokeInitedback to summary
public static void setJavaLangInvokeInited()
shutdownback to summary
public static void shutdown()

Set shutdown state. Shutdown completes when all registered shutdown hooks have been run.

See Also
java.lang.Shutdown
toThreadStateback to summary
public static Thread.State toThreadState(int threadStatus)

Returns Thread.State for the given threadStatus

jdk.internal.misc back to summary

public Interface VM.BufferPool


Provides access to information on buffer usage.

Method Summary

Modifier and TypeMethod and Description
public long
public long
public String
public long

Method Detail

getCountback to summary
public long getCount()
getMemoryUsedback to summary
public long getMemoryUsed()
getNameback to summary
public String getName()
getTotalCapacityback to summary
public long getTotalCapacity()
jdk.internal.misc back to summary

private Class VM.BufferPoolsHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final List<VM.BufferPool>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BUFFER_POOLSback to summary
pack-priv static final List<VM.BufferPool> BUFFER_POOLS

Constructor Detail

BufferPoolsHolderback to summary
private BufferPoolsHolder()