Codemesh Runtime v3 C++ API Reference  3.9.205
Static Public Member Functions | List of all members
xmog_java_lang_System Class Reference

A utility class that exposes some system/runtime functions to C++. More...

#include <xmog_java_lang_System.h>

Static Public Member Functions

static char * getProperty (const char *name, xmog_localenv *env=NULL)
 Returns the value of the given property or NULL if it does not exist. More...
 
static void setProperty (const char *name, const char *value, xmog_localenv *env=NULL)
 Sets the value of the given property. More...
 
static void gc (xmog_localenv *env=NULL)
 Asks the Java garbage collector to run. More...
 
static jlong totalMemory (xmog_localenv *env=NULL)
 Returns the total amount of memory in the JVM. More...
 
static jlong freeMemory (xmog_localenv *env=NULL)
 Returns the amount of free memory in the JVM. More...
 
static jlong maxMemory (xmog_localenv *env=NULL)
 Returns the maximal amount of memory that the JVM will attempt to use. More...
 
static jint availableProcessors (xmog_localenv *env=NULL)
 Returns the number of processors on the system. More...
 

Detailed Description

A utility class that exposes some system/runtime functions to C++.

This class is useful when we need a convenient way to check or modify system properties at runtime, for example in a configuration hook that adds system properties immediately after the JVM has been loaded.

It is also useful when you need to query the grbage collector for stats on available heap, etc.

Member Function Documentation

◆ availableProcessors()

static jint xmog_java_lang_System::availableProcessors ( xmog_localenv env = NULL)
static

Returns the number of processors on the system.

This function is only available in JREs since version 1.4. If called in an earlier JVM, the return value is undefined (but most likely 1).

Parameters
envan optional local call environment. Defaults to NULL.

◆ freeMemory()

static jlong xmog_java_lang_System::freeMemory ( xmog_localenv env = NULL)
static

Returns the amount of free memory in the JVM.

Parameters
envan optional local call environment. Defaults to NULL.

◆ gc()

static void xmog_java_lang_System::gc ( xmog_localenv env = NULL)
static

Asks the Java garbage collector to run.

Parameters
envan optional local call environment. Defaults to NULL.

◆ getProperty()

static char* xmog_java_lang_System::getProperty ( const char *  name,
xmog_localenv env = NULL 
)
static

Returns the value of the given property or NULL if it does not exist.

Parameters
namethe property name.
envan optional local call environment. Defaults to NULL.
Returns
the value or NULL. The caller is responsible for freeing the returned string with a call to xmog_java_string::free() or xmog_util::free().

◆ maxMemory()

static jlong xmog_java_lang_System::maxMemory ( xmog_localenv env = NULL)
static

Returns the maximal amount of memory that the JVM will attempt to use.

This function is only available in JREs since version 1.4.

Parameters
envan optional local call environment. Defaults to NULL.

◆ setProperty()

static void xmog_java_lang_System::setProperty ( const char *  name,
const char *  value,
xmog_localenv env = NULL 
)
static

Sets the value of the given property.

Parameters
namethe property name.
valuethe property value.
envan optional local call environment. Defaults to NULL.

◆ totalMemory()

static jlong xmog_java_lang_System::totalMemory ( xmog_localenv env = NULL)
static

Returns the total amount of memory in the JVM.

Parameters
envan optional local call environment. Defaults to NULL.

The documentation for this class was generated from the following file:

Copyright (c) 1999-2020 by Codemesh, Inc., ALL RIGHTS RESERVED.