Codemesh Runtime v3 C++ API Reference
3.9.205
|
A class representing per-thread information for the integration runtime. More...
#include <xmog_localenv.h>
Public Member Functions | |
xmog_localenv (xmog_jvm *jvm, JNIEnv *env=NULL) | |
void | in_delete (bool bInDelete) |
Sets the value of the bInDelete_ field. More... | |
bool | in_delete () |
Returns the value of the bInDelete_ field. | |
void | in_detach (bool bInDetach) |
Sets the value of the bInDetach_ field. More... | |
bool | in_detach () |
Returns the value of the bInDetach_ field. | |
void | in_exception (bool bInException) |
Sets the value of the bInException_ field. More... | |
bool | in_exception () |
Returns the value of the bInException_ field. | |
xmog_jvm * | getJvm () |
Returns the xmog_jvm pointer that represents the JVM to which this local environment instance belongs. | |
JNIEnv * | getJNIEnv () |
Returns the JNIEnv pointer this local environment wraps around. | |
JNIEnv * | getEnv () |
Returns the JNIEnv pointer this local environment wraps around. More... | |
JavaVM * | getJavaVM () |
Returns the JavaVM pointer that represents the JVM to which this thread is attached. | |
jint | getJNIVersion () |
Returns the JNI version of the JVM to which this thread is attached. | |
void | setDefaultEncoding (xmog_base *_enc) |
Sets the default string encoding that is used when native strings are converted to Java strings. More... | |
xmog_base * | getDefaultEncoding () |
Returns the default string encoding that is used when native strings are converted to Java strings. More... | |
void | set_error_handler (xmog_error_handler *_eh) |
Sets the error handler that will be used for this local environment. More... | |
xmog_error_handler * | get_error_handler () |
Returns the error handler that's used for this local environment. More... | |
void * | operator new (size_t) |
The overloaded operator new. | |
void | operator delete (void *) |
Static Public Member Functions | |
static xmog_localenv * | get_instance (xmog_localenv *env) |
Returns a local environment. More... | |
static void | set_classloader (jobject cl) |
Allows the specification of a classloader to use for the resolution of Java types by name. More... | |
static xmog_localenv * | get_instance (JNIEnv *env) |
Returns a local environment for the JNIEnv pointer that is passed in. More... | |
static xmog_localenv * | get_localenv (JNIEnv *, XMOGVERSION, XMOGCONFIG, XMOGVERSION, const char *, jint) |
Returns a local environment. More... | |
A class representing per-thread information for the integration runtime.
This class provides the necessary abstraction that allows us to support both in-process and out-of-process integration easily. Using APIs provided by this class rather than the internally maintained JNIEnv pointer will greatly improve performance in some scenarios.
This class also maintains several default settings that are, by virtue of this class only being used in a thread-local fashion, per thread settings. The errorhandling policy and the string default encoding are probably the most important of these thread-local settings.
xmog_error_handler* xmog_localenv::get_error_handler | ( | ) |
Returns the error handler that's used for this local environment.
Error handlers are thread specific because a programmer must be able to adjust the errorhandling policy in one thread without affecting the entire application.
|
static |
Returns a local environment for the JNIEnv pointer that is passed in.
While the thread does not have to be attached to the JVM anymore (after all, we already have a JNIEnv pointer), we might need to perform the framework initialization for the thread.
This method is useful in the context of manually implemented native methods, when you want to get a local call environment pointer in the context of a native method call.
env | a JNIEnv pointer. Must be non-NULL . |
|
static |
Returns a local environment.
Attaches the thread if necessary by calling xmog_jvm::attach().
env | a local environment. May be NULL . |
Referenced by xmog_java_array_template< ElementType >::dyna_cast().
|
static |
Returns a local environment.
This method is only supplied to provide already written C++ code with an easier migration path to the 3.0 version of the runtime library. Use the get_instance() method instead when you're writing new code.
xmog_base* xmog_localenv::getDefaultEncoding | ( | ) |
Returns the default string encoding that is used when native strings are converted to Java strings.
The default value will be based on the platform and the version of Java. A value of NULL
is interpreted as meaning that we assume that native strings are UTF-8
strings.
JNIEnv* xmog_localenv::getEnv | ( | ) |
Returns the JNIEnv pointer this local environment wraps around.
void xmog_localenv::in_delete | ( | bool | bInDelete | ) |
Sets the value of the bInDelete_
field.
Don't call this method directly. It is used internally by the framework.
bInDelete | the new value of the field. |
void xmog_localenv::in_detach | ( | bool | bInDetach | ) |
Sets the value of the bInDetach_
field.
Don't call this method directly. It is used internally by the framework.
bInDetach | the new value of the field. |
void xmog_localenv::in_exception | ( | bool | bInException | ) |
Sets the value of the bInException_
field.
Don't call this method directly. It is used internally by the framework.
bInException | the new value of the field. |
|
static |
Allows the specification of a classloader to use for the resolution of Java types by name.
You normally don't have to call this function. This function exists to support the hosting of the runtime or a native library in the context of of a Java application that makes heavy use of classloaders (J2EE server, etc.)
cl | the classloader to use. May be NULL . |
void xmog_localenv::set_error_handler | ( | xmog_error_handler * | _eh | ) |
Sets the error handler that will be used for this local environment.
Error handlers are thread specific because a programmer must be able to adjust the errorhandling policy in one thread without affecting the entire application.
_eh | the error handler instance to be used. |
void xmog_localenv::setDefaultEncoding | ( | xmog_base * | _enc | ) |
Sets the default string encoding that is used when native strings are converted to Java strings.
The default value will be based on the platform and the version of Java. A value of NULL
is interpreted as meaning that the JRE's default encoding is used for strings. The caller remains owner of the _enc
instance that is passed into this method.
_enc | the default encoding that is used to convert between native strings and Java strings on this thread. |