public enum Jvm extends Enum<Jvm>
Modifier and Type | Field and Description |
---|---|
static String |
JAVA_CLASS_PATH |
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 ExceptionHandler |
debug() |
static void |
disableDebugHandler() |
static void |
doNotCloseOnInterrupt(Class clazz,
FileChannel fc) |
static boolean |
dontChain(Class tClass) |
static void |
dumpException(Map<ExceptionKey,Integer> exceptions) |
static 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(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 void |
init() |
static boolean |
is64bit() |
static boolean |
isArm() |
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(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 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 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 ExceptionHandler |
warn() |
public static final String JAVA_CLASS_PATH
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> 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 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 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()
@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
IllegalArgumentException
public 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
- Copyright © 2020. All rights reserved.