List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:October 28 2007 12:08am
Subject:Rev 195: Added code to NdbClusterConnection wrapper destructor to ensure destruction of associated Ndb objects. in http://bazaar.launchpad.net/~ndb-co...
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/telco-6.3

------------------------------------------------------------
revno: 195
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: telco-6.3
timestamp: Sun 2007-10-28 01:07:54 +0100
message:
  Added code to NdbClusterConnection wrapper destructor to ensure destruction of
associated Ndb objects.
modified:
  java/.project                  project-20070521182648-uuhans84tln3f4b6-1
  swig/NdbClusterConnection.i    ndb_cluster_connecti-20070228021421-qkr4cbpxymyqdrf3-6
=== modified file 'java/.project'
--- a/java/.project	2007-05-21 23:00:16 +0000
+++ b/java/.project	2007-10-28 00:07:54 +0000
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>NdbConnectors</name>
+	<name>ndbj-telco-6.3</name>
 	<comment></comment>
 	<projects>
 	</projects>

=== modified file 'swig/NdbClusterConnection.i'
--- a/swig/NdbClusterConnection.i	2007-10-23 23:47:41 +0000
+++ b/swig/NdbClusterConnection.i	2007-10-28 00:07:54 +0000
@@ -38,7 +38,7 @@
 #endif 
 
 
-  ~Ndb_cluster_connection();
+//  ~Ndb_cluster_connection();
 
 
   void set_name(const char* name); 
@@ -81,6 +81,25 @@
 
 %extend Ndb_cluster_connection {
 public:
+  ~Ndb_cluster_connection { 
+    Ndb * tmpNdb = NULL; 
+
+    self->lock_ndb_objects();
+
+    tmpNdb = self->get_next_ndb_object(NULL);
+    while (tmpNdb != NULL) { 
+      Ndb * delNdb = tmpNdb; 
+      tmpNdb = self->get_next_ndb_object(tmpNdb);
+      delete delNdb;
+    }
+
+    tmpNdb = NULL; 
+
+    // Leave Ndb objects locked until we delete the mutex
+    delete self; 
+
+  }
+
   %ndbexception("NdbApiException") createNdb {
     $action
       if (result==NULL) { 

Thread
Rev 195: Added code to NdbClusterConnection wrapper destructor to ensure destruction of associated Ndb objects. in http://bazaar.launchpad.net/~ndb-co...Monty Taylor28 Oct