ivandasch commented on a change in pull request #9521:
URL: https://github.com/apache/ignite/pull/9521#discussion_r740763961



##########
File path: modules/platforms/cpp/core/include/ignite/jni/utils.h
##########
@@ -124,8 +119,16 @@ namespace ignite
             }
 
         private:
+            /** Initializer */
+            void Init(const 
common::concurrent::SharedPointer<java::JniContext>& ctx0, jobject obj0) {
+                ctx = ctx0;
+
+                if (ctx.IsValid())
+                    this->obj = ctx.Get()->Acquire(obj0);
+            }
+
             /** Context. */
-            java::JniContext* ctx;
+            common::concurrent::SharedPointer<java::JniContext> ctx;

Review comment:
       I suppose there is no.
   
   1. JniContext doesn't have any references to JavaGlobalRef
   2. The only declared instance of JavaGlobalRef belongs to IgniteEnvironment, 
the same for shared_ptr to JniContext.
   
   Therefore, there is no cyclic reference and all resources will be freed 
during destruction of IgniteEnvironment.
   
   May be I am wrong, but I suppose that all ok.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to