GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
graphlab::jni_core< Graph, UpdateFunctor > Class Template Reference

#include <graphlab/jni/org_graphlab_Core.hpp>

List of all members.

Public Member Functions

 jni_core (JNIEnv *env, jobject &obj)
core_type & operator() ()
 ~jni_core ()
jobject & obj ()
const jobject & obj () const

Static Public Member Functions

static void set_jvm (JavaVM *jvm)
static JavaVM * get_jvm ()
static void detach_from_jvm ()
static void dump_backtrace (int sig)
static void throw_exception (JNIEnv *env, const char *exception, const char *message)
static JNIEnv * get_jni_env ()

Static Public Attributes

static const size_t ENV_ID = 1

Protected Member Functions

void set_obj (jobject obj)
bool handle_exception (JNIEnv *env) const

Detailed Description

template<typename Graph, typename UpdateFunctor>
class graphlab::jni_core< Graph, UpdateFunctor >

Wrapper for graphlab::core. Contains the core, a reference to the Java core object (so that it doesn't get garbage collected), and other utility functions for dealing with the JVM.

Definition at line 49 of file org_graphlab_Core.hpp.


Constructor & Destructor Documentation

template<typename Graph , typename UpdateFunctor >
graphlab::jni_core< Graph, UpdateFunctor >::jni_core ( JNIEnv *  env,
jobject &  obj 
)
inline

Creates a new graphlab core and a new reference to the associated Java org.graphlab.Core object (so that it doesn't get garbage collected.)

Parameters:
[in]envJNI environment, which will be used to create the reference to the Java object.
[in]objassociated org.graphlab.Core object.

Definition at line 75 of file org_graphlab_Core.hpp.

template<typename Graph , typename UpdateFunctor >
graphlab::jni_core< Graph, UpdateFunctor >::~jni_core ( )
inline

Deallocates the graphlab core. Parent constructor will delete jobject reference.

Definition at line 91 of file org_graphlab_Core.hpp.


Member Function Documentation

template<typename Graph , typename UpdateFunctor >
static void graphlab::jni_core< Graph, UpdateFunctor >::detach_from_jvm ( )
inlinestatic

Detaches the current thread from the JVM. If a pointer to the JNI environment cannot be found in the thread-local store, that means that this thread has already been detached, and the function will return immediately. Otherwise, the thread is detached and the pointer to the JNI environment is removed from the thread-local store.

Definition at line 119 of file org_graphlab_Core.hpp.

template<typename Graph , typename UpdateFunctor >
static JNIEnv* graphlab::jni_core< Graph, UpdateFunctor >::get_jni_env ( )
inlinestatic

Retrieves the JNI environment for the current thread. If a pointer to the JNI environment can be found in the thread-local store, returns immediately; otherwise, that means that the current thread has not been attached to the JVM yet. In that case, this function will attach the current thread to the JVM and save the associated JNI environment to the thread-local storage.

Returns:
JNI environment associated with the current thread.

Definition at line 161 of file org_graphlab_Core.hpp.

template<typename Graph , typename UpdateFunctor >
static JavaVM* graphlab::jni_core< Graph, UpdateFunctor >::get_jvm ( )
inlinestatic

Gets a reference to the Java Virtual Machine.

Returns:
pointer to the Java Virtual Machine

Definition at line 107 of file org_graphlab_Core.hpp.

bool java_any::handle_exception ( JNIEnv *  env) const
protectedinherited

Checks for and rethrows Java exceptions.

Parameters:
[in]envJNI environment
Returns:
true if exception was found; false otherwise

Definition at line 117 of file java_any.cpp.

jobject & java_any::obj ( )
inherited

Retrieves the associated Java object

Definition at line 46 of file java_any.cpp.

template<typename Graph , typename UpdateFunctor >
core_type& graphlab::jni_core< Graph, UpdateFunctor >::operator() ( )
inline

Gets the real graphlab core that this method wraps around

Returns:
graphlab::core

Definition at line 83 of file org_graphlab_Core.hpp.

template<typename Graph , typename UpdateFunctor >
static void graphlab::jni_core< Graph, UpdateFunctor >::set_jvm ( JavaVM *  jvm)
inlinestatic

Saves a reference to the Java Virtual Machine.

Parameters:
[in]jvmpointer to the Java Virtual Machine

Definition at line 99 of file org_graphlab_Core.hpp.

void java_any::set_obj ( jobject  obj)
protectedinherited

Deletes the current ref (if any) and creates a new ref if obj is not null.

Parameters:
[in]objreplaces current object ref

Definition at line 93 of file java_any.cpp.

template<typename Graph , typename UpdateFunctor >
static void graphlab::jni_core< Graph, UpdateFunctor >::throw_exception ( JNIEnv *  env,
const char *  exception,
const char *  message 
)
inlinestatic

Convenience method for throwing Java exceptions

Definition at line 144 of file org_graphlab_Core.hpp.


Member Data Documentation

template<typename Graph , typename UpdateFunctor >
const size_t jni_core::ENV_ID = 1
static

ID of pointer to JNI environment in thread local store

Definition at line 54 of file org_graphlab_Core.hpp.


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