Github user selvaganesang commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1562#discussion_r188042584
--- Diff: core/sqf/src/tm/tmlib.cpp ---
@@ -2817,35 +2833,44 @@ void TMLIB::initialize()
// This call has been changed so that the node count includes spare nodes, so
// will give the wrong value for iv_node_count.
msg_mon_get_node_info(&iv_node_count, MAX_NODES, NULL);
- is_initialized(true);
+ iv_initialized = true;
// We don't use gv_tmlib_initialized but set it here just to keep things aligned.
gv_tmlib_initialized = true;
+ initMutex_->unlock();
}
-
-
// -------------------------------------------------------------------
// TMLIB::initJNI
// Initialize JNI interface
// Only used on demand - if you do this in TMLIB::initialize
// it gets called when it may not be used and conflicts with udrserv.
// -------------------------------------------------------------------
-void TMLIB::initJNI()
+int TMLIB::initJNI()
{
- int lv_err = 0;
- static bool ls_initialized = false;
+ int lv_err = 0;
- //sleep(30);
- if (ls_initialized)
- return;
-
- short lv_result = setupJNI();
- if (lv_result) {
- fprintf(stderr, "setupJNI returned error %d in TMLIB::initJNI. Exiting.\n", lv_result);
- fflush(stderr);
- abort();
+ if ((lv_err = initJNIEnv()) != 0)
+ return lv_err;
+ if (isInitialized())
+ return 0;
+ _tlp_jenv->PopLocalFrame(NULL);
--- End diff --
The method initJNIEnv does pushLocalFrame. Hence we need to do popLocalFrame here. If
you don't popLocalFame, the frame local buffer is leaked.
---
|