public enum Jvm extends Enum<Jvm>
Modifier and Type | Method and Description |
---|---|
static boolean |
areOptionalSafepointsEnabled() |
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 ExceptionHandler |
debug() |
static void |
disableDebugHandler() |
static void |
dumpException(Map<ExceptionKey,Integer> exceptions) |
static ExceptionHandler |
fatal() |
static Field |
getField(Class clazz,
String name)
Get the Field for a class by name.
|
static Method |
getMethod(Class clazz,
String name,
Class... args) |
static int |
getProcessId() |
static <V> V |
getValue(Object obj,
String name) |
static boolean |
hasException(Map<ExceptionKey,Integer> exceptions) |
static boolean |
is64bit() |
static boolean |
isArm() |
static boolean |
isDebug() |
static boolean |
isDebugEnabled(Class aClass) |
static boolean |
isFlightRecorder() |
static boolean |
isJava9Plus() |
static String |
lockWithStack(ReentrantLock lock)
Log the stack trace of the thread holding a lock.
|
static int |
majorVersion() |
static long |
maxDirectMemory() |
static void |
optionalSafepoint() |
static void |
pause(long millis)
Silently pause for milli seconds.
|
static ExceptionHandler |
perf() |
static Map<ExceptionKey,Integer> |
recordExceptions() |
static Map<ExceptionKey,Integer> |
recordExceptions(boolean debug) |
static Map<ExceptionKey,Integer> |
recordExceptions(boolean debug,
boolean exceptionsOnly) |
static 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(ExceptionHandler fatal,
ExceptionHandler warn,
ExceptionHandler debug) |
static void |
setExceptionHandlers(ExceptionHandler fatal,
ExceptionHandler warn,
ExceptionHandler debug,
ExceptionHandler perf) |
static void |
setExceptionsHandlers(ExceptionHandler fatal,
ExceptionHandler warn,
ExceptionHandler debug)
Deprecated.
|
static void |
setThreadLocalExceptionHandlers(ExceptionHandler fatal,
ExceptionHandler warn,
ExceptionHandler debug) |
static void |
setThreadLocalExceptionHandlers(ExceptionHandler fatal,
ExceptionHandler warn,
ExceptionHandler debug,
ExceptionHandler perf) |
static void |
signalHandler(sun.misc.SignalHandler signalHandler)
Helper method for setting the default signals.
|
static boolean |
stackTraceEndsWith(String endsWith,
int n) |
static int |
trimLast(int first,
StackTraceElement[] stes) |
static void |
trimStackTrace(StringBuilder sb,
StackTraceElement... stes)
Append the StackTraceElements to the StringBuilder trimming some internal methods.
|
static long |
usedDirectMemory() |
static long |
usedNativeMemory() |
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 ExceptionHandler |
warn() |
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 int compileThreshold()
public static int majorVersion()
public static boolean isJava9Plus()
public static int getProcessId()
@NotNull public static <T extends Throwable> RuntimeException rethrow(Throwable throwable) throws T extends Throwable
T
- the type of the Throwablethrowable
- to castT
- the throwable as an unchecked throwableT extends Throwable
public static void trimStackTrace(@NotNull StringBuilder sb, @NotNull StackTraceElement... stes)
sb
- to append tostes
- stack trace elementspublic static int trimLast(int first, @NotNull StackTraceElement[] stes)
public static boolean isDebug()
public static boolean isFlightRecorder()
public static void pause(long millis)
millis
- to sleep for.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 Class clazz, @NotNull String name)
clazz
- to get the field forname
- of the fieldpublic static void setAccessible(AccessibleObject h)
public static String lockWithStack(@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 Map<ExceptionKey,Integer> recordExceptions()
@NotNull public static Map<ExceptionKey,Integer> recordExceptions(boolean debug)
@NotNull public static Map<ExceptionKey,Integer> recordExceptions(boolean debug, boolean exceptionsOnly)
@NotNull public static Map<ExceptionKey,Integer> recordExceptions(boolean debug, boolean exceptionsOnly, boolean logToSlf4j)
public static boolean hasException(@NotNull Map<ExceptionKey,Integer> exceptions)
@Deprecated public static void setExceptionsHandlers(@Nullable ExceptionHandler fatal, @Nullable ExceptionHandler warn, @Nullable ExceptionHandler debug)
public static void setExceptionHandlers(@Nullable ExceptionHandler fatal, @Nullable ExceptionHandler warn, @Nullable ExceptionHandler debug)
public static void setExceptionHandlers(@Nullable ExceptionHandler fatal, @Nullable ExceptionHandler warn, @Nullable ExceptionHandler debug, @Nullable ExceptionHandler perf)
public static void setThreadLocalExceptionHandlers(@Nullable ExceptionHandler fatal, @Nullable ExceptionHandler warn, @Nullable ExceptionHandler debug)
public static void setThreadLocalExceptionHandlers(@Nullable ExceptionHandler fatal, @Nullable ExceptionHandler warn, @Nullable ExceptionHandler debug, @Nullable ExceptionHandler perf)
@NotNull public static ExceptionHandler fatal()
@NotNull public static ExceptionHandler warn()
@NotNull public static ExceptionHandler perf()
@NotNull public static ExceptionHandler debug()
public static void dumpException(@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()
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
IllegalArgumentException
Copyright © 2019. All rights reserved.