public final class V8Host
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
clearInternalStatistic()
Clear internal statistic for internal test purpose.
|
void |
closeV8Runtime(V8Runtime v8Runtime)
Close V8 runtime.
|
<R extends V8Runtime> |
createV8Runtime()
Create V8 runtime.
|
<R extends V8Runtime> |
createV8Runtime(boolean pooled,
RuntimeOptions<?> runtimeOptions)
Create V8 runtime by pooled flag and custom global name.
|
<R extends V8Runtime> |
createV8Runtime(RuntimeOptions<?> runtimeOptions)
Create V8 runtime by custom global name.
|
V8Host |
disableGCNotification()
Disable GC notification.
|
V8Host |
enableGCNotification()
Enable GC notification.
|
static V8Host |
getInstance(JSRuntimeType jsRuntimeType)
Gets instance by JS runtime type.
|
long[] |
getInternalStatistic()
Get internal statistic for test purpose.
|
java.lang.String |
getJavetVersion()
Gets javet version.
|
JSRuntimeType |
getJSRuntimeType()
Gets JS runtime type.
|
JavetException |
getLastException()
Gets last exception.
|
IJavetLogger |
getLogger()
Gets logger.
|
static double |
getMemoryUsageThresholdRatio()
Gets memory usage threshold ratio.
|
static V8Host |
getNodeI18nInstance()
Gets Node i18n instance.
|
static V8Host |
getNodeInstance()
Gets Node instance.
|
long |
getSleepIntervalMillis()
Gets sleep interval millis.
|
static V8Host |
getV8I18nInstance()
Gets V8 i18n instance.
|
static V8Host |
getV8Instance()
Gets V8 instance.
|
int |
getV8RuntimeCount()
Gets V8 runtime count.
|
V8SharedMemoryStatistics |
getV8SharedMemoryStatistics()
Gets V8 shared memory statistics.
|
boolean |
isI18nEnabled()
Is i18n enabled.
|
boolean |
isIsolateCreated()
Is isolate created.
|
boolean |
isLibraryLoaded()
Is library loaded.
|
static boolean |
isLibraryReloadable()
Determines whether the JNI library is reloadable or not.
|
boolean |
loadLibrary()
Load library.
|
static void |
setLibraryReloadable(boolean libraryReloadable)
Sets whether the JNI library is reloadable or not.
|
static void |
setMemoryUsageThresholdRatio(double memoryUsageThresholdRatio)
Sets memory usage threshold ratio.
|
void |
setSleepIntervalMillis(long sleepIntervalMillis)
Sets sleep interval millis.
|
boolean |
unloadLibrary()
Unload library.
|
public static V8Host getInstance(JSRuntimeType jsRuntimeType)
jsRuntimeType
- the JS runtime typepublic static double getMemoryUsageThresholdRatio()
public static V8Host getNodeI18nInstance()
Note: Node runtime library is loaded by a custom class loader.
public static V8Host getNodeInstance()
Note: Node runtime library is loaded by a custom class loader.
public static V8Host getV8I18nInstance()
Note: V8 runtime library is loaded by a custom class loader.
public static V8Host getV8Instance()
Note: V8 runtime library is loaded by a custom class loader.
public static boolean isLibraryReloadable()
public static void setLibraryReloadable(boolean libraryReloadable)
libraryReloadable
- true: reloadable, false: not reloadablepublic static void setMemoryUsageThresholdRatio(double memoryUsageThresholdRatio)
This manageable usage threshold attribute is designed for monitoring the increasing trend of memory usage with low overhead.
memoryUsageThresholdRatio
- the memory usage threshold ratiopublic void clearInternalStatistic()
public void closeV8Runtime(V8Runtime v8Runtime)
v8Runtime
- the V8 runtimepublic <R extends V8Runtime> R createV8Runtime() throws JavetException
R
- the type parameterJavetException
- the javet exceptionpublic <R extends V8Runtime> R createV8Runtime(RuntimeOptions<?> runtimeOptions) throws JavetException
R
- the type parameterruntimeOptions
- the runtime optionsJavetException
- the javet exceptionpublic <R extends V8Runtime> R createV8Runtime(boolean pooled, RuntimeOptions<?> runtimeOptions) throws JavetException
R
- the type parameterpooled
- the pooledruntimeOptions
- the runtime optionsJavetException
- the javet exceptionpublic V8Host disableGCNotification()
public V8Host enableGCNotification()
public long[] getInternalStatistic()
public JSRuntimeType getJSRuntimeType()
public java.lang.String getJavetVersion()
public JavetException getLastException()
public IJavetLogger getLogger()
public long getSleepIntervalMillis()
public int getV8RuntimeCount()
public V8SharedMemoryStatistics getV8SharedMemoryStatistics()
public boolean isI18nEnabled()
public boolean isIsolateCreated()
public boolean isLibraryLoaded()
public boolean loadLibrary()
Note: setLibraryReloadable(true) must be called, otherwise, JVM will crash.
public void setSleepIntervalMillis(long sleepIntervalMillis)
sleepIntervalMillis
- the sleep interval millispublic boolean unloadLibrary()
Note: setLibraryReloadable(true) must be called, otherwise, JVM will crash.