[TRAFODION-2821] Trafodion core code base needs to be thread safe #1493
Conversation
Java exceptions thrown while calling the java methods from JNI in Trafodion are stored in the current context. However in a multi-threaded ESP environment, these exceptions should be stored in thread specific variable to enable error handling to be thread safe. Otherwise, the JNI errors could be overwritten by the JNI errors from another thread. Also streamlined JNI error handling by extending the getExceptionDetails() methods to log the errors also. Incorporated error handling in SequenceFileReader JNI methods.
Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2511/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/2511/ |
@robertamarton Can you please review this change |
+1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall. I think there is one place where a PopLocalFrame call was removed that perhaps should not have been.
getExceptionDetails(); | ||
logError(CAT_SQL_HBASE, __FILE__, __LINE__); | ||
logError(CAT_SQL_HBASE, "HBaseClient_JNI::releaseHTableClient()", getLastError()); | ||
jenv_->PopLocalFrame(NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to delete the jenv_->PopLocalFrame call here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I will add it back in my next check-in
Fixes as per review comments and missed out changes in the commit 073cf68
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2519/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/2519/ |
+1. Looks good to me. |
Java exceptions thrown while calling the java methods from JNI in
Trafodion are stored in the current context. However in a multi-threaded
ESP environment, these exceptions should be stored in thread specific
variable to enable error handling to be thread safe. Otherwise, the JNI
errors could be overwritten by the JNI errors from another thread.
Also streamlined JNI error handling by extending the getExceptionDetails()
method to log the errors also.
Incorporated error handling in SequenceFileReader JNI methods.