CUBRID Engine  latest
jsp_sr.c File Reference
#include "config.h"
#include <dlfcn.h>
#include <jni.h>
#include <locale.h>
#include <assert.h>
#include <vector>
#include <string>
#include <sstream>
#include <iterator>
#include "jsp_sr.h"
#include "jsp_file.h"
#include "boot_sr.h"
#include "environment_variable.h"
#include "system_parameter.h"
#include "release_string.h"
#include "memory_alloc.h"
#include "error_manager.h"
Include dependency graph for jsp_sr.c:

Go to the source code of this file.

Macros

#define JVM_LIB_PATH   ""
 
#define JVM_LIB_PATH_JDK11   ""
 
#define JVM_LIB_FILE   "libjvm.so"
 
#define BUF_SIZE   2048
 
#define JVM_GetEnv(JVM, ENV, VER)   (*JVM)->GetEnv(JVM, ENV, VER)
 
#define JVM_AttachCurrentThread(JVM, ENV, ARGS)   (*JVM)->AttachCurrentThread(JVM, ENV, ARGS)
 
#define JVM_DetachCurrentThread(JVM)   (*JVM)->DetachCurrentThread(JVM)
 
#define JVM_ExceptionOccurred(ENV)   (*ENV)->ExceptionOccurred(ENV)
 
#define JVM_FindClass(ENV, NAME)   (*ENV)->FindClass(ENV, NAME)
 
#define JVM_GetStaticMethodID(ENV, CLAZZ, NAME, SIG)   (*ENV)->GetStaticMethodID(ENV, CLAZZ, NAME, SIG)
 
#define JVM_NewStringUTF(ENV, BYTES)   (*ENV)->NewStringUTF(ENV, BYTES);
 
#define JVM_NewObjectArray(ENV, LENGTH, ELEMENTCLASS, INITIALCLASS)   (*ENV)->NewObjectArray(ENV, LENGTH, ELEMENTCLASS, INITIALCLASS)
 
#define JVM_SetObjectArrayElement(ENV, ARRAY, INDEX, VALUE)   (*ENV)->SetObjectArrayElement(ENV, ARRAY, INDEX, VALUE)
 
#define JVM_CallStaticVoidMethod(ENV, CLAZZ, METHODID, ARGS)   (*ENV)->CallStaticVoidMethod(ENV, CLAZZ, METHODID, ARGS)
 
#define JVM_CallStaticIntMethod(ENV, CLAZZ, METHODID, ARGS)   (*ENV)->CallStaticIntMethod(ENV, CLAZZ, METHODID, ARGS)
 
#define JVM_CallStaticObjectMethod(ENV, CLAZZ, METHODID, ARGS)   (*ENV)->CallStaticObjectMethod(ENV, CLAZZ, METHODID, ARGS)
 
#define JVM_GetStringUTF(ENV, STRING)   (*ENV)->GetStringUTFChars(ENV, STRING, NULL)
 
#define JVM_ReleaseStringUTF(ENV, JSTRING, CSTRING)   (*ENV)->ReleaseStringUTFChars(ENV, JSTRING, CSTRING)
 
#define JVM_GetStringUTFLength(ENV, STRING)   (*ENV)->GetStringUTFLength(ENV, STRING)
 

Typedefs

typedef jint(* CREATE_VM_FUNC) (JavaVM **, void **, void *)
 

Functions

static void * jsp_get_create_java_vm_function_ptr (void)
 
static int jsp_create_java_vm (JNIEnv **env_p, JavaVMInitArgs *vm_arguments)
 
static std::vector< std::string > jsp_tokenize_jvm_options (char *opt_str)
 
int jsp_start_server (const char *db_name, const char *path, int port)
 
int jsp_server_port (void)
 
int jsp_jvm_is_loaded (void)
 

Variables

static JavaVM * jvm = NULL
 
static jint sp_port = -1
 
static std::string err_msgs
 

Macro Definition Documentation

#define BUF_SIZE   2048

Definition at line 109 of file jsp_sr.c.

#define JVM_AttachCurrentThread (   JVM,
  ENV,
  ARGS 
)    (*JVM)->AttachCurrentThread(JVM, ENV, ARGS)

Definition at line 146 of file jsp_sr.c.

#define JVM_CallStaticIntMethod (   ENV,
  CLAZZ,
  METHODID,
  ARGS 
)    (*ENV)->CallStaticIntMethod(ENV, CLAZZ, METHODID, ARGS)

Definition at line 164 of file jsp_sr.c.

Referenced by jsp_start_server().

#define JVM_CallStaticObjectMethod (   ENV,
  CLAZZ,
  METHODID,
  ARGS 
)    (*ENV)->CallStaticObjectMethod(ENV, CLAZZ, METHODID, ARGS)

Definition at line 166 of file jsp_sr.c.

#define JVM_CallStaticVoidMethod (   ENV,
  CLAZZ,
  METHODID,
  ARGS 
)    (*ENV)->CallStaticVoidMethod(ENV, CLAZZ, METHODID, ARGS)

Definition at line 162 of file jsp_sr.c.

#define JVM_DetachCurrentThread (   JVM)    (*JVM)->DetachCurrentThread(JVM)

Definition at line 148 of file jsp_sr.c.

#define JVM_ExceptionOccurred (   ENV)    (*ENV)->ExceptionOccurred(ENV)

Definition at line 150 of file jsp_sr.c.

Referenced by jsp_start_server().

#define JVM_FindClass (   ENV,
  NAME 
)    (*ENV)->FindClass(ENV, NAME)

Definition at line 152 of file jsp_sr.c.

Referenced by jsp_start_server().

#define JVM_GetEnv (   JVM,
  ENV,
  VER 
)    (*JVM)->GetEnv(JVM, ENV, VER)

Definition at line 144 of file jsp_sr.c.

#define JVM_GetStaticMethodID (   ENV,
  CLAZZ,
  NAME,
  SIG 
)    (*ENV)->GetStaticMethodID(ENV, CLAZZ, NAME, SIG)

Definition at line 154 of file jsp_sr.c.

Referenced by jsp_start_server().

#define JVM_GetStringUTF (   ENV,
  STRING 
)    (*ENV)->GetStringUTFChars(ENV, STRING, NULL)

Definition at line 168 of file jsp_sr.c.

#define JVM_GetStringUTFLength (   ENV,
  STRING 
)    (*ENV)->GetStringUTFLength(ENV, STRING)

Definition at line 172 of file jsp_sr.c.

#define JVM_LIB_FILE   "libjvm.so"

Definition at line 101 of file jsp_sr.c.

Referenced by jsp_get_create_java_vm_function_ptr().

#define JVM_LIB_PATH   ""

Definition at line 91 of file jsp_sr.c.

Referenced by jsp_get_create_java_vm_function_ptr().

#define JVM_LIB_PATH_JDK11   ""

Definition at line 92 of file jsp_sr.c.

Referenced by jsp_get_create_java_vm_function_ptr().

#define JVM_NewObjectArray (   ENV,
  LENGTH,
  ELEMENTCLASS,
  INITIALCLASS 
)    (*ENV)->NewObjectArray(ENV, LENGTH, ELEMENTCLASS, INITIALCLASS)

Definition at line 158 of file jsp_sr.c.

Referenced by jsp_start_server().

#define JVM_NewStringUTF (   ENV,
  BYTES 
)    (*ENV)->NewStringUTF(ENV, BYTES);

Definition at line 156 of file jsp_sr.c.

Referenced by jsp_start_server().

#define JVM_ReleaseStringUTF (   ENV,
  JSTRING,
  CSTRING 
)    (*ENV)->ReleaseStringUTFChars(ENV, JSTRING, CSTRING)

Definition at line 170 of file jsp_sr.c.

#define JVM_SetObjectArrayElement (   ENV,
  ARRAY,
  INDEX,
  VALUE 
)    (*ENV)->SetObjectArrayElement(ENV, ARRAY, INDEX, VALUE)

Definition at line 160 of file jsp_sr.c.

Referenced by jsp_start_server().

Typedef Documentation

typedef jint(* CREATE_VM_FUNC) (JavaVM **, void **, void *)

Definition at line 110 of file jsp_sr.c.

Function Documentation

static int jsp_create_java_vm ( JNIEnv **  env_p,
JavaVMInitArgs *  vm_arguments 
)
static

Definition at line 479 of file jsp_sr.c.

References ARG_FILE_LINE, ER_ERROR_SEVERITY, er_set(), ER_SP_JVM_LIB_NOT_FOUND, err_msgs, jsp_get_create_java_vm_function_ptr(), and jvm.

Referenced by jsp_start_server().

Here is the caller graph for this function:

static void * jsp_get_create_java_vm_function_ptr ( void  )
static

Definition at line 405 of file jsp_sr.c.

References err_msgs, JVM_LIB_FILE, JVM_LIB_PATH, JVM_LIB_PATH_JDK11, and NULL.

Referenced by jsp_create_java_vm().

Here is the caller graph for this function:

int jsp_jvm_is_loaded ( void  )

Definition at line 774 of file jsp_sr.c.

References jvm, and NULL.

Referenced by conn_restart_client(), css_setup_server_loop(), and db_restart().

Here is the caller graph for this function:

int jsp_server_port ( void  )

Definition at line 751 of file jsp_sr.c.

References boot_db_name(), javasp_read_info(), and sp_port.

Referenced by javasp_start_server(), jsp_get_server_port(), and sjsp_get_server_port().

Here is the caller graph for this function:

static std::vector<std::string> jsp_tokenize_jvm_options ( char *  opt_str)
static

Definition at line 515 of file jsp_sr.c.

Referenced by jsp_start_server().

Here is the caller graph for this function:

Variable Documentation

std::string err_msgs
static

Definition at line 179 of file jsp_sr.c.

Referenced by jsp_create_java_vm(), and jsp_get_create_java_vm_function_ptr().

JavaVM* jvm = NULL
static

Definition at line 176 of file jsp_sr.c.

Referenced by jsp_create_java_vm(), jsp_jvm_is_loaded(), and jsp_start_server().

jint sp_port = -1
static

Definition at line 177 of file jsp_sr.c.

Referenced by jsp_server_port(), and jsp_start_server().