trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvaganesang <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #861: [TRAFODION-1988] Better java exceptio...
Date Wed, 07 Dec 2016 22:13:58 GMT
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/861#discussion_r91400045
  
    --- Diff: core/sqf/src/seatrans/tm/hbasetmlib2/javaobjectinterfacetm.cpp ---
    @@ -352,12 +349,11 @@ JOI_RetCode JavaObjectInterfaceTM::init(char*           className,
           // Allocate an object of the Java class, and call its constructor.
           // The constructor must be the first entry in the methods array.
           javaObj_ = _tlp_jenv->NewObject(javaClass, JavaMethods[0].methodID);
    -      if (javaObj_ == 0 || _tlp_jenv->ExceptionCheck())
    -      { 
    -        _tlp_jenv->ExceptionDescribe();
    -        _tlp_jenv->ExceptionClear();
    -        _tlp_jenv->DeleteLocalRef(javaClass);  
    -        return JOI_ERROR_NEWOBJ;
    +      if (getExceptionDetails(NULL)) {
    +         tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)"JavaObjectInterfaceTM::init()",

    +             (char *)_tlp_error_msg->c_str(), -1LL);
    +         _tlp_jenv->DeleteLocalRef(javaClass);  
    --- End diff --
    
    In line 361 the global reference of the JavaClass needs to be retained. This ensures that
the class reference is never unloaded via gc and all the method ids associated with the class
remains valid. This was the one of the possible reasons for the obscure core seen in TM.
    
    For the error path case, it should be ok to delete the global reference, but the TM process
is unusable and it would be aborted anyway


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message