[commit] r2528 - trunk/SDK/Java/native/JavaCompRunner

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Sep 17 11:13:38 CDT 2014


Author: ksmyth
Date: Wed Sep 17 11:13:38 2014
New Revision: 2528

Log:
JavaCompRunner: support being called within a transaction

Modified:
   trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp

Modified: trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp
==============================================================================
--- trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp	Wed Sep 17 11:13:22 2014	(r2527)
+++ trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp	Wed Sep 17 11:13:38 2014	(r2528)
@@ -219,8 +219,14 @@
 	COMTRY 
     {
 		CComPtr<IMgaTerritory> terr;
-		COMTHROW(project->CreateTerritory(NULL, &terr));
-		COMTHROW(project->BeginTransaction(terr));
+		long projectStatus;
+		COMTHROW(project->get_ProjectStatus(&projectStatus));
+		bool invokeExStartedATransaction = false;
+		if (!(projectStatus & 8))
+		{
+			COMTHROW(project->BeginTransactionInNewTerr(TRANSACTION_GENERAL, &terr));
+			invokeExStartedATransaction = true;
+		}
 		try 
         {
             // load java VM
@@ -260,7 +266,8 @@
             //app->m_env->CallStaticVoidMethod(entryClass, entryMethod, NULL, NULL, project, currentobj, 
               //          selectedobjs, param);
 
-			COMTHROW(project->CommitTransaction());
+			if (invokeExStartedATransaction)
+				COMTHROW(project->CommitTransaction());
 		}	
 		catch(jthrowable jexc){
 			char buf[200];
@@ -296,16 +303,19 @@
 				AfxMessageBox("Java exception occurred at component invokation, the cause is unrecoverable.");
 			}
 
-			project->AbortTransaction(); 
+			if (invokeExStartedATransaction)
+				project->AbortTransaction();
 
 		}
 		catch(HKEY){
-			project->AbortTransaction(); 
+			if (invokeExStartedATransaction)
+				project->AbortTransaction(); 
 		}
         catch(...) 
         {
             AfxMessageBox("Internal error while executing java interpreter.");
-            project->AbortTransaction(); 
+			if (invokeExStartedATransaction)
+				project->AbortTransaction(); 
             throw;
         }
 	}


More information about the gme-commit mailing list