public enum Jvm extends Enum<Jvm>
| Modifier and Type | Field and Description |
|---|---|
static String |
JAVA_CLASS_PATH |
static String |
SYSTEM_PROPERTIES |
| Modifier and Type | Method and Description |
|---|---|
static long |
address(ByteBuffer bb) |
static void |
addToClassPath(Class clazz)
Makes sure all the jars etc in the current class loader have been added to the class path.
|
static boolean |
areOptionalSafepointsEnabled() |
static int |
arrayByteBaseOffset() |
static void |
busyWaitMicros(long micros)
This method is designed to be used when the time to be waited is very small, typically under a millisecond.
|
static void |
busyWaitUntil(long waitUntil)
This method is designed to be used when the time to be waited is very small, typically under a millisecond.
|
static ClassMetrics |
classMetrics(Class c) |
static int |
compileThreshold() |
static @NotNull ExceptionHandler |
debug() |
static void |
disableDebugHandler() |
static void |
doNotCloseOnInterrupt(Class clazz,
FileChannel fc) |
static boolean |
dontChain(Class tClass) |
static void |
dumpException(@NotNull Map<ExceptionKey,Integer> exceptions) |
static @NotNull ExceptionHandler |
fatal() |
static boolean |
getBoolean(String property)
A more permissive boolean System property flag.
|
static boolean |
getBoolean(String property,
boolean defaultValue)
A more permissive boolean System property flag.
|
static double |
getDouble(String property,
double defaultValue) |
static Field |
getField(@NotNull Class clazz,
@NotNull String name)
Get the Field for a class by name.
|
static Field |
getFieldOrNull(@NotNull Class clazz,
@NotNull String name) |
static Method |
getMethod(@NotNull Class clazz,
@NotNull String name,
Class... args)
get method for class if it exists or throws
AssertionError. |
static int |
getProcessId() |
static <V> V |
getValue(@NotNull Object obj,
@NotNull String name) |
static boolean |
hasException(@NotNull Map<ExceptionKey,Integer> exceptions) |
static void |
init() |
static boolean |
is64bit() |
static boolean |
isArm() |
static boolean |
isCodeCoverage() |
static boolean |
isDebug() |
static boolean |
isDebugEnabled(Class aClass) |
static boolean |
isFlightRecorder() |
static boolean |
isJava12Plus() |
static boolean |
isJava14Plus() |
static boolean |
isJava9Plus() |
static boolean |
isProcessAlive(long pid)
checks if a process is still alive
|
static boolean |
isResourceTracing() |
static String |
lockWithStack(@NotNull ReentrantLock lock)
Log the stack trace of the thread holding a lock.
|
static int |
majorVersion() |
static long |
maxDirectMemory() |
static void |
nanoPause()
Pause in a busy loop for a very short time.
|
static void |
optionalSafepoint()
Deprecated.
|
static void |
pause(long millis)
Silently pause for milli seconds.
|
static @NotNull ExceptionHandler |
perf() |
static @NotNull Map<ExceptionKey,Integer> |
recordExceptions() |
static @NotNull Map<ExceptionKey,Integer> |
recordExceptions(boolean debug) |
static @NotNull Map<ExceptionKey,Integer> |
recordExceptions(boolean debug,
boolean exceptionsOnly) |
static @NotNull Map<ExceptionKey,Integer> |
recordExceptions(boolean debug,
boolean exceptionsOnly,
boolean logToSlf4j) |
static void |
resetExceptionHandlers() |
static <T extends Throwable> |
rethrow(Throwable throwable)
Cast a CheckedException as an unchecked one.
|
static void |
safepoint() |
static void |
setAccessible(AccessibleObject h) |
static void |
setExceptionHandlers(@Nullable ExceptionHandler fatal,
@Nullable ExceptionHandler warn,
@Nullable ExceptionHandler debug) |
static void |
setExceptionHandlers(@Nullable ExceptionHandler fatal,
@Nullable ExceptionHandler warn,
@Nullable ExceptionHandler debug,
@Nullable ExceptionHandler perf) |
static void |
setExceptionsHandlers(@Nullable ExceptionHandler fatal,
@Nullable ExceptionHandler warn,
@Nullable ExceptionHandler debug)
Deprecated.
|
static void |
setThreadLocalExceptionHandlers(@Nullable ExceptionHandler fatal,
@Nullable ExceptionHandler warn,
@Nullable ExceptionHandler debug) |
static void |
setThreadLocalExceptionHandlers(@Nullable ExceptionHandler fatal,
@Nullable ExceptionHandler warn,
@Nullable ExceptionHandler debug,
@Nullable ExceptionHandler perf) |
static void |
signalHandler(sun.misc.SignalHandler signalHandler)
Helper method for setting the default signals.
|
static boolean |
stackTraceEndsWith(String endsWith,
int n) |
static @NotNull ExceptionHandler |
startup() |
static int |
trimLast(int first,
@NotNull StackTraceElement[] stes) |
static void |
trimStackTrace(@NotNull StringBuilder sb,
StackTraceElement... stes)
Append the StackTraceElements to the StringBuilder trimming some internal methods.
|
static long |
usedDirectMemory() |
static long |
usedNativeMemory() |
static String |
userHome() |
static Jvm |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Jvm[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
static @NotNull ExceptionHandler |
warn() |
public static final String JAVA_CLASS_PATH
public static final String SYSTEM_PROPERTIES
public static Jvm[] values()
for (Jvm c : Jvm.values()) System.out.println(c);
public static Jvm valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static void init()
public static int compileThreshold()
public static int majorVersion()
public static boolean isJava9Plus()
public static boolean isJava12Plus()
public static boolean isJava14Plus()
public static int getProcessId()
@NotNull public static <T extends Throwable> @NotNull RuntimeException rethrow(Throwable throwable) throws T extends Throwable
T - the type of the Throwablethrowable - to castT - the throwable as an unchecked throwableT extends Throwablepublic static void trimStackTrace(@NotNull
@NotNull StringBuilder sb,
@NotNull
StackTraceElement... stes)
sb - to append tostes - stack trace elementspublic static int trimLast(int first,
@NotNull
@NotNull StackTraceElement[] stes)
public static boolean isDebug()
public static boolean isFlightRecorder()
public static boolean isCodeCoverage()
public static void pause(long millis)
millis - to sleep for.public static void nanoPause()
public static void busyWaitMicros(long micros)
micros - Time in microspublic static void busyWaitUntil(long waitUntil)
waitUntil - nanosecond precision counter value to await.public static Field getField(@NotNull @NotNull Class clazz, @NotNull @NotNull String name)
clazz - to get the field forname - of the fieldpublic static Field getFieldOrNull(@NotNull @NotNull Class clazz, @NotNull @NotNull String name)
public static Method getMethod(@NotNull @NotNull Class clazz, @NotNull @NotNull String name, Class... args)
AssertionError. This will not detect a default
method unless the class explicitly overrides itclazz - classname - nameargs - argspublic static void setAccessible(AccessibleObject h)
public static String lockWithStack(@NotNull @NotNull ReentrantLock lock)
lock - to logpublic static long usedDirectMemory()
public static long usedNativeMemory()
public static long maxDirectMemory()
public static boolean is64bit()
public static void resetExceptionHandlers()
public static void disableDebugHandler()
@NotNull public static @NotNull Map<ExceptionKey,Integer> recordExceptions()
@NotNull public static @NotNull Map<ExceptionKey,Integer> recordExceptions(boolean debug)
@NotNull public static @NotNull Map<ExceptionKey,Integer> recordExceptions(boolean debug, boolean exceptionsOnly)
@NotNull public static @NotNull Map<ExceptionKey,Integer> recordExceptions(boolean debug, boolean exceptionsOnly, boolean logToSlf4j)
public static boolean hasException(@NotNull
@NotNull Map<ExceptionKey,Integer> exceptions)
@Deprecated public static void setExceptionsHandlers(@Nullable @Nullable ExceptionHandler fatal, @Nullable @Nullable ExceptionHandler warn, @Nullable @Nullable ExceptionHandler debug)
public static void setExceptionHandlers(@Nullable
@Nullable ExceptionHandler fatal,
@Nullable
@Nullable ExceptionHandler warn,
@Nullable
@Nullable ExceptionHandler debug)
public static void setExceptionHandlers(@Nullable
@Nullable ExceptionHandler fatal,
@Nullable
@Nullable ExceptionHandler warn,
@Nullable
@Nullable ExceptionHandler debug,
@Nullable
@Nullable ExceptionHandler perf)
public static void setThreadLocalExceptionHandlers(@Nullable
@Nullable ExceptionHandler fatal,
@Nullable
@Nullable ExceptionHandler warn,
@Nullable
@Nullable ExceptionHandler debug)
public static void setThreadLocalExceptionHandlers(@Nullable
@Nullable ExceptionHandler fatal,
@Nullable
@Nullable ExceptionHandler warn,
@Nullable
@Nullable ExceptionHandler debug,
@Nullable
@Nullable ExceptionHandler perf)
@NotNull public static @NotNull ExceptionHandler fatal()
@NotNull public static @NotNull ExceptionHandler warn()
@NotNull public static @NotNull ExceptionHandler startup()
@NotNull public static @NotNull ExceptionHandler perf()
@NotNull public static @NotNull ExceptionHandler debug()
public static void dumpException(@NotNull
@NotNull Map<ExceptionKey,Integer> exceptions)
public static boolean isDebugEnabled(Class aClass)
public static void signalHandler(sun.misc.SignalHandler signalHandler)
signalHandler - to call on a signalpublic static void safepoint()
@Deprecated public static void optionalSafepoint()
public static boolean areOptionalSafepointsEnabled()
public static boolean stackTraceEndsWith(String endsWith, int n)
public static boolean isArm()
public static ClassMetrics classMetrics(Class c) throws IllegalArgumentException
IllegalArgumentExceptionpublic static String userHome()
public static boolean dontChain(Class tClass)
public static boolean isResourceTracing()
public static boolean getBoolean(String property)
-Dflag-Dflag=true -Dflag=yes
are all acceptedproperty - name to lookuppublic static boolean getBoolean(String property, boolean defaultValue)
-Dflag -Dflag=true -Dflag=yes
are all acceptedproperty - name to lookupdefaultValue - value to be used if unknownpublic static long address(ByteBuffer bb)
public static int arrayByteBaseOffset()
public static void doNotCloseOnInterrupt(Class clazz, FileChannel fc)
public static void addToClassPath(Class clazz)
clazz - to use as a template.public static double getDouble(String property, double defaultValue)
public static boolean isProcessAlive(long pid)
pid - the pid of the process you wish to checkCopyright © 2020. All rights reserved.